stop read in newline
hi all, i'm so mess up w/ this pro.
suppose a data file File.dat:
a b c d e
how can i stop read those character when matching the newline?
note: # of words must be counted
thanx for any help!!
while(fscanf(in, "%c", &word)!=EOF)
printf("newline matched, stop reading file!\n");
printf("%d words are read, bye\n", i);
%c is a single character, not a string.
%s is a string.
fgets() will read a string, including, but not past, the newline.