The [] are being used to denote an optional section.
So if you want a C-string of 20 characters you would have:
width of 20
specifier of s
So your format specifier would be:
%20s
I see ... I guess now the confusion is in how can I get that in when the "MAX_LEN" could be changed? I can't simply put it in this form:
#define MAX_LEN 20
FILE *file;
char buffer[MAX_LEN];
fscanf(file, "%MAX_LENs", buffer);
Last edited on