Search code examples
cwinapilpcwstr

Manipulate LPCWSTR in c


I have a given LPCWSTR variable, which holds a full path.

I want to extract from it only the file name.

Any suggestions how can I manipulate the LPCWSTR to achieve that?

In addition - How can I get the char in a specific index of the LPCWSTR?

Thank you.


Solution

  • The windows function PathStripPath will do what you want. Since you have a Unicode string you'll want to call the "W" version PathStripPathW.