-
string problem
I have an issue with the file reading.
for example ,we have a set of cards but before it, there is an int like:
12
king of clubs
six of clubs
four of diamonds
six of hearts
four of hearts
If I use fgets and fputs to read and print the file, what can I do so that I star reading and print from the second line( skip the line with 12)
I called each line LINE and set a while loop
Code:
while( 1 ) {/*while begins*/
fgets(LINE, sizeof(LINE), fin);
if ( feof(fin) ) /* check for EOF right after fgets() */
break;
fputs(LINE, fout);}
I dont succeed to skip the first line I tried LINE+1 but it is an horizontal displacement..
Can I have some suuggestions?
-
Code:
fgets( line, sizeof line, fin ); /* ignore the first line */
while( fgets( line, sizeof line, fin ) != NULL )
{
fputs( line, fout );
}
Nice and clean, without all the crap.
Quzah.