Как читать и печатать пути к файлам с символами/символами Юникода? ⇐ C++
Как читать и печатать пути к файлам с символами/символами Юникода?
I have no issues reading file paths with ASCII characters but have issues reading file paths with Unicode characters. I have tried to ensure that the code is correctly encoded to support unicode characters but it still doesnt work. How do i read the paths of the files and folders that have unicode characters or symbols?
#include #include #include #include #include #include // Function to list files in BFS order void ListFilesBFS(const std::wstring& inputDirectoryPath, std::wofstream& out) { std::queue pathsQueue; pathsQueue.push(inputDirectoryPath); // Loop until all directories have been processed while (!pathsQueue.empty()) { // Get the current directory path from the front of the queue std::wstring currentPath = pathsQueue.front(); pathsQueue.pop(); // Find the first file or directory in the current directory WIN32_FIND_DATAW findFileData; HANDLE hFind = FindFirstFileW((currentPath + L"\\*").c_str(), &findFileData); if (hFind == INVALID_HANDLE_VALUE) { // If unable to traverse the directory, print error and continue to next iteration std::wcerr
Источник: https://stackoverflow.com/questions/781 ... rs-symbols
I have no issues reading file paths with ASCII characters but have issues reading file paths with Unicode characters. I have tried to ensure that the code is correctly encoded to support unicode characters but it still doesnt work. How do i read the paths of the files and folders that have unicode characters or symbols?
#include #include #include #include #include #include // Function to list files in BFS order void ListFilesBFS(const std::wstring& inputDirectoryPath, std::wofstream& out) { std::queue pathsQueue; pathsQueue.push(inputDirectoryPath); // Loop until all directories have been processed while (!pathsQueue.empty()) { // Get the current directory path from the front of the queue std::wstring currentPath = pathsQueue.front(); pathsQueue.pop(); // Find the first file or directory in the current directory WIN32_FIND_DATAW findFileData; HANDLE hFind = FindFirstFileW((currentPath + L"\\*").c_str(), &findFileData); if (hFind == INVALID_HANDLE_VALUE) { // If unable to traverse the directory, print error and continue to next iteration std::wcerr
Источник: https://stackoverflow.com/questions/781 ... rs-symbols
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение