Now I would like to open one data file, which utilizes the ';' to start commend. I want to scan all data before ;, which use a blank to separate each other.
The following code I just can scan the first data, how can I modify it to scan the following data before ';'.
Thanx a lot.
int main ( )
FILE *fp = fopen( "input.txt", "r" );
while ( fgets(buff,BUFSIZ,fp) != NULL )
char *comment = strchr( buff, ';' );
if ( comment != NULL ) *comment = '\0'; //blow away the comment
if ( sscanf( buff, "%f", &var ) == 1 )
printf( "Data=%f\n", var );