Hey.
I am trying to list a folder which has non-english character files.
Below function takes an argument, say C:\
and lists the files inside it. But not 100% correctly. For Turkish characters it prints some symbols, even though I used wchar_t
type.
void listFolder(const wchar_t* path){
DIR *dir;
struct _wdirent *dp;
wchar_t * file_name;
wchar_t fullpath[MAX_PATH];
dir = _wopendir(path);
while ((dp=_wreaddir(dir)) != NULL) {
//printf("[i]debug: \t%s\n", dp->d_name);
if ( !wcscmp(dp->d_name, L".") || !wcscmp(dp->d_name, L"..") ){
// do nothing
}
else {
file_name = dp->d_name; // use it
wprintf(L"[*]file_name: \t\"%ls\"\n",file_name);
}
}
_wclosedir(dir);
}
I am currently using Windows 7 x64 with CodeBlocks 16.01
Strange part is, same function works perfectly fine under Ubuntu 16.04 with CodeBlocks.