Parse a text in a function

So, I am trying to parse a txt file like:


main(){
ifstream tex("te.txt");

stopwo(tex);

categ(tex);

}

But stopwo is going to exit in the middle of the text file. How would I have categ pick up where stopwo left off? Thanks!
If the functions take a reference to the ifstream object, then they will modify the original "tex" object. When input is read from ifstream, it is discarded from the buffer, so categ() will essentially pickup where stopwo() left off. If the functions take copies of the object, then change them to take references instead.
I have it like

stopwo(ifstream& tex){...}

categ(ifstream& tex){...}

main(){
ifstream tex("te.txt");

stopwo(tex);

categ(tex);

}

already but it is still being discarded from the buffer
categ() will pickup from where stopwo() left off in your current setup.
Topic archived. No new replies allowed.