1 #include <msvcrt/stdlib.h>
2 #include <msvcrt/string.h>
8 void _wsplitpath(const wchar_t* path, wchar_t* drive, wchar_t* dir, wchar_t* fname, wchar_t* ext)
14 tmp_drive = (wchar_t*)wcschr(path,L':');
17 wcsncpy(drive,tmp_drive-1,2);
24 tmp_drive = (wchar_t*)path - 1;
27 tmp_dir = (wchar_t*)wcsrchr(path,L'\\');
30 wcsncpy(dir,tmp_drive+1,tmp_dir-tmp_drive);
31 *(dir+(tmp_dir-tmp_drive)) = 0;
36 tmp_ext = (wchar_t*)wcsrchr(path,L'.');
38 tmp_ext = (wchar_t*)path+wcslen(path);
45 wcsncpy(fname,tmp_dir+1,tmp_ext-tmp_dir-1);
46 *(fname+(tmp_ext-tmp_dir-1)) = 0;
48 wcsncpy(fname,tmp_drive+1,tmp_ext-tmp_drive-1);
49 *(fname+(tmp_ext-path))=0;