I want to parse a file which has the following format:
foam offset: 10.00, 20.00
foam size: 1250.00, 600.00
melting radius: 1.30
supporters: 10
70.00
200.00
300.00
400.00
500.00
600.00
700.00
800.00
900.00
1000.00
The code I have so far:
fscanf(stream,"foam offset: %lf, %lf",&FoamOffset[0],&FoamOffset[1]);
fscanf(stream,"foam size: %lf, lf\n",&FoamSize[0],&FoamSize[1]);
fscanf(stream,"melting radius: %lf",&ToolRadius);
fscanf(stream,"supporters: %d",&SupporterCount);
for( i = 0; i < SupporterCount; i++ )
{
fscanf(stream,"%lf",&SupporterPositions);
}
But it only reads the first line (debugged: all the other fcanfs return 0). According to the reference, the function should "read and ignore any whitespace characters (this includes blank spaces and the newline and tab characters) which are encountered before the next non-whitespace character". But it seems it doesn't. Before I start to hack I ask it here: what's the problem? (and I want to keep it flexible in the future (so it should not be whitespace-sensitive))
Thanks in advance!