Stuck on converting string

Hello,

I'm making a function to list the directories that exists within the given directory. I'm using the boost library in my program, but the funcion designed for this action is not working. So I'm trying it manually with the functions FindFirstFile and FindNextFile. My problem is that my own function takes a string (from the Standard C++ Library (<String>) ) and the functions from the winapi needs LPCTSTR (or CTSTR). I have no idea how to convert it.
So my question is: How do I convert a char array/pointer (or string maybe) to (LP)CSTR?
Hmmm, the winapi doc on msdn says you need LPCTSTR, wich is easy to make out of a string or char variable, but the compiler says you actually need LPWCSTR, so how do convert it to LPWCSTR?
I have something like this:
1
2
LPWSTR cwPath;
int iPathSize = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, path.c_str(), -1, cwPath, 0);

path here is an string.
It seems that iPathSize is filled correctly but cwPath is not.
God!
I found the function FindFirstFileA, here I can just fill in the path as char.
I've posted this message today, but I was searching for days, so I happy I found this xD
Topic archived. No new replies allowed.