L
Lars Nielsen
Hey there
I have a win32 application written i c++. I have a std::vector of
std::string's i will fill with filenames.
typedef vector<std::string> strvector;
strvector vFiles;
WIN32_FIND_DATA fd;
HANDLE hFind = INVALID_HANDLE_VALUE;
hFind = FindFirstFile(szDataDir, &fd);
if(hFind == INVALID_HANDLE_VALUE)
{
return ERROR_INVALID_HANDLE;
}
else
{
while(FindNextFile(hFind, &fd) != 0)
{
if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
vFiles.push_back(fd.cFileName);
}
}
}
Since the cFileName is a WCHAR[260] array this code wont compile.
Can anyone tell how i can convert the wchar[] to a std::string, so I
can push it onto the vector?
Thanks
Lars
I have a win32 application written i c++. I have a std::vector of
std::string's i will fill with filenames.
typedef vector<std::string> strvector;
strvector vFiles;
WIN32_FIND_DATA fd;
HANDLE hFind = INVALID_HANDLE_VALUE;
hFind = FindFirstFile(szDataDir, &fd);
if(hFind == INVALID_HANDLE_VALUE)
{
return ERROR_INVALID_HANDLE;
}
else
{
while(FindNextFile(hFind, &fd) != 0)
{
if(!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
vFiles.push_back(fd.cFileName);
}
}
}
Since the cFileName is a WCHAR[260] array this code wont compile.
Can anyone tell how i can convert the wchar[] to a std::string, so I
can push it onto the vector?
Thanks
Lars