I\'m trying to read a line using the following code:
while(fscanf(f, \"%[^\\n\\r]s\", cLine) != EOF )
{
/* do something with cLine */
}
Using fscanf to read/tokenise a file always results in fragile code or pain and suffering. Reading a line, and tokenising or scanning that line is safe, and effective. It needs more lines of code - which means it takes longer to THINK about what you want to do (and you need to handle a finite input buffer size) - but after that life just stinks less.
Don't fight fscanf. Just don't use it. Ever.