Bonjour a tous,
je suis entrain de réaliser un programme et j'ai un soucis de lécture , j'ai un fichier encodé en ANSI et je n'arrive pas à le lire correctement dans mon programme (linux)
voila ma fonction :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| int parsing_data(t_data *data)
{
wchar_t **tmp = NULL;
wchar_t line[MAX_LEN_CONFIG] = {0};
FILE *file = NULL;
printf("on ouvre le fichier [%s]\n", data->path);
if ((file = fopen(data->path, "r,ccs=UNICODE")) == NULL)
return (log_std_error(data->path, -1, LOG, "ERROR", 1));
printf("ouverture OK\n");
while (fgetws(line, MAX_LEN_CONFIG, file) != NULL)
{
printf("[%ls]\n", line);
}
return 1;
} |
J'ai essayer sa aussi :
if ((file = fopen(data->path, "r")) == NULL)
je n'ai aucune ligne qui s'affiche , je pense que c'est un soucis d'encodage , le programme passe une fois dans la boucle et en sort pourtant il y a plusieurs ligne dans le fichier.
Partager