FindFirstFile wants an unsigned short* ?
-
Hello, I'm trying to use the API FindFirstFile in a non-MFC DLL using VC++ 6 and I get the following error on compile: error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char *' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast On this line: HANDLE Finding = FindFirstFile("C:\\*.*", &FindFileData); Now I can be stupid, but I don't think that a pattern, which is described as an LPCSTR in the MSDN, would ask for an unsigned short*... Can anybody tell me what I'm doing wrong here? Thanks, - Fahr
-
Hello, I'm trying to use the API FindFirstFile in a non-MFC DLL using VC++ 6 and I get the following error on compile: error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char *' to 'const unsigned short *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast On this line: HANDLE Finding = FindFirstFile("C:\\*.*", &FindFileData); Now I can be stupid, but I don't think that a pattern, which is described as an LPCSTR in the MSDN, would ask for an unsigned short*... Can anybody tell me what I'm doing wrong here? Thanks, - Fahr
-
-
-
That why also my guess. Have you tried
HANDLE Finding = FindFirstFile(_T("C:\\*.*"), &FindFileData);
? regards
Well, that seems to work (could you maybe also explain WHY it works?) Now I get an error on this: FString temp = ANSI_TO_TCHAR(FindFileData.cFileName); it seems to be related, too, the error reads; error C2664: 'winGetSizeUNICODE' : cannot convert parameter 1 from 'unsigned short [260]' to 'const char *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast a _T() or L() doesn't work here tho :S - Fahr
-
Well, that seems to work (could you maybe also explain WHY it works?) Now I get an error on this: FString temp = ANSI_TO_TCHAR(FindFileData.cFileName); it seems to be related, too, the error reads; error C2664: 'winGetSizeUNICODE' : cannot convert parameter 1 from 'unsigned short [260]' to 'const char *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast a _T() or L() doesn't work here tho :S - Fahr
-
That could very well be, how would I check that? I DID tweak a lot of the compler and linker settings... How is that related anyways? - Fahr
FindFirstFileW is the wide-char version of FindFirstFile. somehow, you've made the compiler think it needs be using this version instead of FindFirstFileA (the single-byte version).
I'm not the droid you're looking for.