FindFirstFile

Hey
I want to read every file in a directory and cut it out afterwards. Therefore I want to use FindFirstFile. My code looks like the following:


string path;
string fullPath;

HANDLE hFile;
WIN32_FIND_DATA fileInformation;

//FILE_PATTERN = const string "kev*"
//baseDirectory = string
path = baseDirectory + "\\" + FILE_PATTERN;

hFile = ::FindFirstFile(path.c_str(), &fileInformation);

Now I get the following error and I don't know why:

Error 1 error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'

I looked at the code example from Example (http://www.dev-archive.com/forum/showthread.php?t=312461) , but I think there's hardly any difference, or am I just blind...?

I'm using VS2005 on Windows XP.

Can anyone help me? Thanks.
[922 byte] By [Corpse] at [2007-11-20 8:43:27]
# 1 Re: FindFirstFile
use FindFirstFileA instead of FindFirstFile
ashukasama at 2007-11-9 13:30:37 >
# 2 Re: FindFirstFile
It works! Thank you very much!!
Corpse at 2007-11-9 13:31:37 >
# 3 Re: FindFirstFile
Either change your project settings to use multi byte instead of unicode character set, or you should use std::wstring instead of std::string.

The reason is that VS2005 defaults to UNICODE character set, whereas earlier versions defaulted to non UNICODE settings.

-Regards NotSoSuperHero
Notsosuperhero at 2007-11-9 13:32:46 >