I\'m trying to read a line using the following code:
while(fscanf(f, \"%[^\\n\\r]s\", cLine) != EOF )
{
/* do something with cLine */
}
i think the problem with this code is because when you read with %[^\n\r]s, in fact, you reading until reach '\n' or '\r', but you don't reading the '\n' or '\r' also. So you need to get this character before you read with fscanf again at loop. Do something like that:
do{
fscanf(f, "%[^\n\r]s", cLine) != EOF
/* Do something here */
}while(fgetc(file) != EOF)