Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   File Line Re-arranging program (http://www.go4expert.com/forums/file-line-arranging-program-t5102/)

Frusciante 4Jul2007 13:08

File Line Re-arranging program
 
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!

shabbir 4Jul2007 14:02

Re: File Line Re-arranging program
 
c == getchar() will go through the content of the file character by character.

DaWei 4Jul2007 17:18

Re: File Line Re-arranging program
 
Look up fgets.


All times are GMT +5.5. The time now is 13:45.