Convertir char * en LPCWSTR
Bonjour,
Je parcours tous les fichiers d'un dossier en C++.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
...
WIN32_FIND_DATA data;
HANDLE h = FindFirstFile("test/*.*", &data);
BOOL bMoreFiles = (h != INVALID_HANDLE_VALUE);
while (bMoreFiles)
{
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
;
}else {
using namespace std;
ostringstream oss;
for (unsigned int j=0 ; j<strlen(data.cFileName); j++)
oss << setfill('0') << static_cast<char>(data.cFileName[j]);
string s = "test/" + oss.str();
std::wstring ws;
ws.assign(s.begin(), s.end());
cout << ws.c_str() << endl;
fi.Find(ws.c_str());
......
}
bMoreFiles = FindNextFile(h, &data);
}
... |
Le problème est que ma méthode fi.Find(...) doit obligatoirement recevoir un LPCWSTR... et moi j'ai un char* (char[260]).
Pour le moment ca compile mais le COUT ne m'affiche pas le bon nom de fichier, il m'affiche 003A05F8 au lieu de /test/monfichier.txt.
Et le find ne le trouve donc pas ;)
Pouvez vous m'aider?
Merci ;)