wstrrchr(strrchr) Need to get path

I have some problem with this code :(
This is my code:

1
2
3
wchar_t fullpath[0x128];
fullpath = L"/card/music/song.mp3";
wchar_t * pos = wstrrchr(fullpath,'/');


Result:
pos+1 = song.mp3

My problem, how to get extract out the path only?
I mean this /card/music/

i tried many way, but still no luck.
Last edited on
A quick way would be to copy the string (if you need the original) and put a '\0' at pos+1.
Thanks for the idea.

Full working code:
1
2
3
4
5
6
wchar_t* buffer = new wchar_t[0x128];
wchar_t* fpath = new wchar_t[0x128];
wchar_t* fullpath = L"/card/music/artist/song.mp3";
wchar_t* pos = wstrrchr(fullpath,'/');
*pos = _NULL;
snwprintf( buffer, 0x128, L"Path: %ls\nFile: %ls\n",fullpath,pos+1 );

Topic archived. No new replies allowed.