Reading a file and then printing

Hi!

I am writting a program that needs to be able to open up a .txt file check its content go through the lines and pick out certain lines for example:

1234 content: 1030 //it would read this
1234 content: 1243 //it would read this
2344 content: 1245 //but not this

it should parse through the line and when it see "as in the example" 1234 in the beginning of a line it writes it to another file defined within the function.

im mostly good with the general aspect of the program itself but i cant get my head around reading the file as specified.

I thought of doing something like:

If ( "row" begins = 1234)
{
int x1;
int x1 = row1;
}

but as a automated process, then i would just pass the x1 to a print command printing it in the new file.

ps: a plus would be if it could read 1234 then skip the "content:" part and only read the next numbers (another thing of note is that it needs to be able to read mixes of number/letters so just telling it to only read numbers wont work.)

best regards
Last edited on
Topic archived. No new replies allowed.