1 #include <crtdll/stdlib.h>
2 #include <crtdll/string.h>
4 void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext )
10 tmp_drive = (char *)strchr(path,':');
11 if ( tmp_drive != (char *)NULL ) {
12 strncpy(drive,tmp_drive-1,1);
17 tmp_drive = (char *)path;
20 tmp_dir = (char *)strrchr(path,'\\');
21 if( tmp_dir != NULL && tmp_dir != tmp_drive + 1 ) {
22 strncpy(dir,tmp_drive+1,tmp_dir - tmp_drive);
23 *(dir + (tmp_dir - tmp_drive)) = 0;
28 tmp_ext = ( char *)strrchr(path,'.');
29 if ( tmp_ext != NULL ) {
35 tmp_ext = (char*)path+strlen(path);
37 if ( tmp_dir != NULL ) {
38 strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
39 *(fname + (tmp_ext - tmp_dir -1)) = 0;
43 strncpy(fname,path,tmp_ext - path);
44 *(fname+(tmp_ext-path))=0;