Check the return value more carefully fscanf(); it will return, for example, 3 if it matches 3 fields. You might want to be careful about the size of the various lines in order to avoid buffer overflows, that is, probably for another day.
, , , , fscanf() .
( , ) MacOS X.
int main(void)
{
char b1[20], b2[20], b3[20], b4[20], b5[20];
while (fscanf(stdin,"%s\t%s\t%s\t%s\t%s\t", b1, b2, b3, b4, b5) == 5)
printf("%s\t%s\t%s\t%s\t%s\n", b1, b2, b3, b4, b5);
return 0;
}
'k k k k k' (5 , ) 5 . , Β§7.19.6.2 C :
: , (%, ), .
( isspace) , [, c n.
, '% s', :
.
, . " (fgets()) ". 5 , , . fscanf() . 8 , , ..