Manipulating an LPCWSTR?
Lets say I have an LPCWSTR like L"models/bones/skull.x". how can I seperate the path to skull.x and "skull.x"? That is how can I make L"models/bones/skull.x" into L"models/bones/" L"skull.x"?
I appreciate any help :)
PathFindFileName(). This function returns a pointer to the location in your string that the filename starts. It doesnt take constant strings so if you can use LPWSTR that would be better. If not, you can perform a const_cast.
Hi Chillypacman -
I personally would use std::wstring for this.
You could do like path.rfind('/') to find the last path delimiter of the string then use two std::wstring::substr calls to separate them out.
I personally would use std::wstring for this.
You could do like path.rfind('/') to find the last path delimiter of the string then use two std::wstring::substr calls to separate them out.
Quote:Original post by Colin Jeanne
PathFindFileName(). This function returns a pointer to the location in your string that the filename starts. It doesnt take constant strings so if you can use LPWSTR that would be better. If not, you can perform a const_cast.
I tried that but I'm getting a link2019 error,
error LNK2019: unresolved external symbol __imp__PathFindFileNameW@4 referenced in function "bool __cdecl ObjectSetup(void)" (?ObjectSetup@@YA_NXZ)
I'm including "Shlwapi.h" since that is where PathFindFileName is.
Make sure you're also linking 'shlwapi.lib' into your executable. By including the header the symbol is declared, but without linking in the library it's never defined.
Cheers!
Cheers!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement