I'm trying to read a return delimited file. full of phrases.
I'm trying to put each phrase into a string.
The problem is that when I try to read the file with
fscanf(file,"%50s\n",string);
the string only contains one word. when it bumps with a space it stops reading the string
fscanf(file, "%[^\n]")
, you'll just keep getting the empty string over and over again. You need to consume the newline with either a whitespace in the format string, or something like%*c
. – Asthenopia