Guest User

Untitled

a guest
Jan 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. char myip[INET_ADDRSTRLEN];
  2. fscanf(file, "%16s", myip);
  3.  
  4. #define _STRIFY(x) #x
  5. char myip[INET_ADDRSTRLEN];
  6. fscanf(file, "%" _STRIFY(INET_ADDRSTRLEN) "s", myip);
  7.  
  8. unknown conversion character type 'N' format
  9.  
  10. char format[14];
  11. sprintf(format, "%%%ds", INET_ADDRSTRLEN-1);
  12. fscanf(file, format, myip);
  13.  
  14. #define stringify_1(x...) #x
  15. #define stringify(x...) stringify_1(x)
  16.  
  17. char myip[INET_ADDRSTRLEN];
  18. fscanf(file, "%" stringify(INET_ADDRSTRLEN) "s", myip);
Add Comment
Please, Sign In to add comment