1 #include <msvcrt/stdlib.h>
2 #include <msvcrt/string.h>
8 void _splitpath(const char* path, char* drive, char* dir, char* fname, char* ext)
14 tmp_drive = (char*)strchr(path,':');
17 strncpy(drive,tmp_drive-1,2);
24 tmp_drive = (char*)path - 1;
27 tmp_dir = (char*)strrchr(path,'\\');
30 strncpy(dir,tmp_drive+1,tmp_dir-tmp_drive);
31 *(dir+(tmp_dir-tmp_drive)) = 0;
37 tmp_ext = (char*)strrchr(path,'.');
39 tmp_ext = (char*)path+strlen(path);
46 strncpy(fname,tmp_dir+1,tmp_ext-tmp_dir-1);
47 *(fname+(tmp_ext-tmp_dir-1)) = 0;
49 strncpy(fname,tmp_drive+1,tmp_ext-tmp_drive-1);
50 *(fname+(tmp_ext-path))=0;