G
Gary Wessle
Hi
I have a method A which have a loop, in that loop, another method B is
called, B opens a file and does getline till found something
interesting, does something with it and return void. then the A loop
goes on till the next time B is called.
B does while( getline( ofstraam, line ) )
I am trying not to getline all over from scratch again every time B is
called but instead keep getline "ganging" in there waiting for B to be
called again.
what do I do, do I pass an open ofstream as B argument?
thank you
****************************************************************
A()
{
while ( flag )
{
/* ... */
B ( file_name, string_to_find, end_point );
}
}
B()
{
ifstream ifs( file_name.c_str() );
while( getline( ifs, line ) )
{
// does this line have the end_point then break
// look for string_to_find and do something.
}
// next time B is called with a different end_point that is after the
// previous end_point, I do not want to start from the first line.
****************************************************************
I have a method A which have a loop, in that loop, another method B is
called, B opens a file and does getline till found something
interesting, does something with it and return void. then the A loop
goes on till the next time B is called.
B does while( getline( ofstraam, line ) )
I am trying not to getline all over from scratch again every time B is
called but instead keep getline "ganging" in there waiting for B to be
called again.
what do I do, do I pass an open ofstream as B argument?
thank you
****************************************************************
A()
{
while ( flag )
{
/* ... */
B ( file_name, string_to_find, end_point );
}
}
B()
{
ifstream ifs( file_name.c_str() );
while( getline( ifs, line ) )
{
// does this line have the end_point then break
// look for string_to_find and do something.
}
// next time B is called with a different end_point that is after the
// previous end_point, I do not want to start from the first line.
****************************************************************