File Line Re-arranging program

Frusciante's Avatar, Join Date: Jul 2007
Light Poster
Hi!
I'm writing a small C program to post process a huge txt file produced by a CFD software.

The CFD creates a "from.txt" file, in which every line contains many parameters calculated by it.
I need to copy the lines that contain the information i need to another "to.txt" files.

The problem is that I don´t know how to go thru the lines of the from.txt.
Once i know how to go thru them it wouldn't be that hard to write the rest of the program.

I working on something like...

fp=fopen(filename,"r");
while(c == getchar());
if (c == \n);

... but i have no idea how to go on...

I`m a newbie in this world... hope learn a lot from you all!
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
c == getchar() will go through the content of the file character by character.
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Look up fgets.