1 #include <msvcrt/stdlib.h>
2 #include <msvcrt/string.h>
5 void _splitpath(const char* path, char* drive, char* dir, char* fname, char* ext)
11 tmp_drive = (char*)strchr(path,':');
12 if ( tmp_drive != (char*)NULL ) {
13 strncpy(drive,tmp_drive-1,1);
18 tmp_drive = (char*)path;
21 tmp_dir = (char*)strrchr(path,'\\');
22 if( tmp_dir != NULL && tmp_dir != tmp_drive + 1 ) {
23 strncpy(dir,tmp_drive+1,tmp_dir - tmp_drive);
24 *(dir + (tmp_dir - tmp_drive)) = 0;
29 tmp_ext = ( char* )strrchr(path,'.');
30 if ( tmp_ext != NULL ) {
36 tmp_ext = (char*)path+strlen(path);
38 if ( tmp_dir != NULL ) {
39 strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
40 *(fname + (tmp_ext - tmp_dir -1)) = 0;
44 strncpy(fname,path,tmp_ext - path);
45 *(fname+(tmp_ext-path))=0;