O
Owner
int v[31];
int dayc = 0; /* day count read */
int daytotal = 0; /* day total */
while (scanf("%*s %*s %d%*c", &daytotal) == 1){
v[dayc++] = daytotal;
data file contains
3-13-2011 tue 2234.93
4-30-2011 wed 4233.43
5-23-2011 mon 2314.98
..
..
..
it only read first line from data file and then quits.
I'm suspecting something out of argument format.
I added "%*c" for newline character at the end of line.
Is this becuase in dos, newline character is cr and lf.
should I put "%*2c"? then it will fix the problem?
int dayc = 0; /* day count read */
int daytotal = 0; /* day total */
while (scanf("%*s %*s %d%*c", &daytotal) == 1){
v[dayc++] = daytotal;
data file contains
3-13-2011 tue 2234.93
4-30-2011 wed 4233.43
5-23-2011 mon 2314.98
..
..
..
it only read first line from data file and then quits.
I'm suspecting something out of argument format.
I added "%*c" for newline character at the end of line.
Is this becuase in dos, newline character is cr and lf.
should I put "%*2c"? then it will fix the problem?