bonne soirée,
j ai un problem avec la fonction sscanf quand je l'utilise avec les flag de compilation -Wall -W -Werror -ansi -pedantic.
je veux convertire une chaine de caractere a un mode_t et uid_t .....
c mon code :
char pathname[NAMSIZ];
mode_t mode;
uid_t uid;
gid_t gid;
off_t size;
time_t mtime;
struct utimbuf utbuf;
int checksum;
sscanf(header->name, "%s", pathname);
sscanf(header->mode, "%6ho ", &mode);
sscanf(header->uid, "%6ho ", &uid);
sscanf(header->gid, "%6ho ", &gid);
sscanf(header->size, "%11lo ", &size);
sscanf(header->mtime, "%11lo ", &mtime);
sscanf(header->chksum, "%6o", &checksum);
header c 'est une structure, tou les champ de cette structure sn de type char
les erreurs afficher :
untar_it.c: In function ‘untar_it’:
untar_it.c:77:3: error: format ‘%6ho’ expects type ‘short unsigned int *’, but argument 3 has type ‘mode_t *’
untar_it.c:78:3: error: format ‘%6ho’ expects type ‘short unsigned int *’, but argument 3 has type ‘uid_t *’
untar_it.c:79:3: error: format ‘%6ho’ expects type ‘short unsigned int *’, but argument 3 has type ‘gid_t *’
untar_it.c:80:3: error: format ‘%11lo’ expects type ‘long unsigned int *’, but argument 3 has type ‘off_t *’
untar_it.c:81:3: error: format ‘%11lo’ expects type ‘long unsigned int *’, but argument 3 has type ‘time_t *’
untar_it.c:82:3: error: format ‘%6o’ expects type ‘unsigned int *’, but argument 3 has type ‘int *’
PS : sans les flag ca marche tres bien, svp aidez moi vite svp encore merci.