alın: göreli dizinde ./test/*
her dosya adlarını yazdırırWIN32_FIND_DATA - Böyle bir şey kullanıyorum mutlak yolunu
std::string tempDirectory = "./test/*";
WIN32_FIND_DATA directoryHandle;
memset(&directoryHandle, 0, sizeof(WIN32_FIND_DATA));//perhaps redundant???
std::wstring wideString = std::wstring(tempDirectory.begin(), tempDirectory.end());
LPCWSTR directoryPath = wideString.c_str();
//iterate over all files
HANDLE handle = FindFirstFile(directoryPath, &directoryHandle);
while(INVALID_HANDLE_VALUE != handle)
{
//skip non-files
if (!(directoryHandle.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
//convert from WCHAR to std::string
size_t size = wcslen(directoryHandle.cFileName);
char * buffer = new char [2 * size + 2];
wcstombs(buffer, directoryHandle.cFileName, 2 * size + 2);
std::string file(buffer);
delete [] buffer;
std::cout << file;
}
if(FALSE == FindNextFile(handle, &directoryHandle)) break;
}
//close the handle
FindClose(handle);
.
Bu dizinin mutlak yolunu belirlemenin herhangi bir yolu var mı, tıpkı realpath()
gibi Linux'ta BOOST gibi herhangi bir üçüncü taraf kitaplığı içermiyor mu? Her dosyaya mutlak yol yazdırmak istiyorum.
[UNC] (http://en.wikipedia.org/wiki/Uniform_Naming_Convention#Uniform_Naming_Convention) yolu mu istiyorsunuz? –
Bence böyle genel bir çözüme ihtiyacım var. Yerel yol şu an için iyi olmalıdır (C: \ bla \ blabla \ etc'de olduğu gibi). –
Yerel bir yolun garantisi yoktur. –