Yes WIN32 makes everything complex. I assume you are using some family of Windows Visual Studio 2005 or 2008.
Are you sure the command argument came in in WIDE form? My guess is that it did not. What does your main header look like? Does it have char* or _TCHAR* in front of argv[]?
FindFirstFile() takes wide chars. You may need to convert the incoming simple string argv[1] to wide.
Code:
WCHAR bufw[500];
...
void convert_to_wide(char *buf, WCHAR *crap) {
while (*crap++ = *buf++); }
...
convert_to_wide(argv[1], bufw);
...
hFind = FindFirstFile(bufw, &FindFileData);
Then to display the returned file name you need to convert back to regular strings...
Code:
char buff[500];
...
void convert_to_string(WCHAR *crap, char *buf) {
// convert wide-char to normal char
while (*buf++ = (char)*crap++); }
...
convert_to_string(FindFileData.cFileName, buff);
Or you can keep everything as wide strings throughout - saving all that to-and-from conversions. But I haven't seen a smooth integration of the standard library functions to go with that.