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,':');
15 if ( tmp_drive != (char *)NULL ) {
16 strncpy(drive,tmp_drive-1,1);
21 tmp_drive = (char *)path;
24 tmp_dir = (char *)strrchr(path,'\\');
25 if( tmp_dir != NULL && tmp_dir != tmp_drive + 1 ) {
26 strncpy(dir,tmp_drive+1,tmp_dir - tmp_drive);
27 *(dir + (tmp_dir - tmp_drive)) = 0;
32 tmp_ext = ( char *)strrchr(path,'.');
33 if ( tmp_ext != NULL ) {
39 tmp_ext = (char*)path+strlen(path);
41 if ( tmp_dir != NULL ) {
42 strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
43 *(fname + (tmp_ext - tmp_dir -1)) = 0;
47 strncpy(fname,path,tmp_ext - path);
48 *(fname+(tmp_ext-path))=0;