7 void _tsplitpath(const _TCHAR
* path
, _TCHAR
* drive
, _TCHAR
* dir
, _TCHAR
* fname
, _TCHAR
* ext
)
9 _TCHAR
* tmp_drive
= NULL
;
10 _TCHAR
* tmp_dir
= NULL
;
11 _TCHAR
* tmp_ext
= NULL
;
13 tmp_drive
= (_TCHAR
*)_tcschr(path
,':');
18 _tcsncpy(drive
,tmp_drive
-1,2);
28 tmp_drive
= (_TCHAR
*)path
- 1;
31 tmp_dir
= (_TCHAR
*)_tcsrchr(path
,'\\');
36 _tcsncpy(dir
,tmp_drive
+1,tmp_dir
-tmp_drive
);
37 *(dir
+(tmp_dir
-tmp_drive
)) = 0;
45 /* If the dot is before the last dir separator, it's part
46 * of a directory name, not the start of the extension */
47 if (!tmp_ext
|| tmp_ext
< tmp_dir
)
49 tmp_ext
= (_TCHAR
*)path
+_tcslen(path
);
60 _tcsncpy(fname
,tmp_dir
+1,tmp_ext
-tmp_dir
-1);
61 *(fname
+(tmp_ext
-tmp_dir
-1)) = 0;
65 _tcsncpy(fname
,tmp_drive
+1,tmp_ext
-tmp_drive
-1);
66 *(fname
+(tmp_ext
-path
))=0;