I have a problem with some special characters. When I go across the lines with the debug tool, I see the variable caminho (a std::string) with the expected values: "maçã", but the variables "stemp" and "aux" have squares instead of "ç" and "ã".
After the line 4 the program does´t break, but it stops working like expected.
If [FindFirstFile()] fails or fails to locate files from the search string in the lpFileName parameter, the return value is INVALID_HANDLE_VALUE and the contents of lpFindFileData are indeterminate.
2. What's happening is that Visual Studio is properly decoding the contents of caminho based on your system's locale with the correct code page, using MultiByteToWideChar(). If you want to use the Unicode functions you need to convert your narrow strings using that function.
3. However, it'd be much easier to simply call the ANSI functions instead:
4. Do note that if you use the ANSI functions, your code will only work if the system is set to the correct locale. If someone in, say, Spain tries to run your program, it may not work.