c - Is there a way of getting dirent's ent->d_name as w_char *? -


i generate list of files using dirent l getting worried directories , files contain unicode characters.

void recurse_dir(char *dir) {     dir* d;     d = opendir(dir);     struct dirent* ent;     unsigned short int dir_size = strlen(dir), tmp_dir_size;     if(d != null)     {         while((ent = readdir(d)) != null)         {             if(ent->d_type == dt_dir)             {                 if(!strcmp(ent->d_name,".") || !strcmp(ent->d_name,".."))                     continue;                 folder_count++;                 char tmp_dir[dir_size + strlen(ent->d_name) + 2];                 tmp_dir[0] = '\0';                 strcat(tmp_dir,dir);                 strcat(tmp_dir,"/");                 strcat(tmp_dir,ent->d_name);                 recurse_dir(tmp_dir);             }             else             {                 file_count++;                 file_strs_size += dir_size + strlen(ent->d_name) + 2;                 fprintf(list_fp, "%s/%s\n",dir, ent->d_name);             }         }     }     closedir(d); } 

is there way l can ent->d_name in wide string format?

you can store unicode characters in char array, using utf-8 format. way os storing name, if want name in utf-16 or utf-32 can conversion using function takes care of that, example iconv.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -