I want to parse an ip from file using fscanf (C code using gcc). so, I want to do:
char myip[INET_ADDRSTRLEN];
fscanf(file, "%16s", myip);
but, I don't want to hardcode the number 16, so I'm trying to use macro, but it doesn't work.
#define _STRIFY(x) #x
char myip[INET_ADDRSTRLEN];
fscanf(file, "%" _STRIFY(INET_ADDRSTRLEN) "s", myip);
here is the error I get
unknown conversion character type 'N' format
so what is wrong with my code ?
thanks for your help :)