This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ file processing


Why doesn't ifstream overload operator>> for const
char * types so that one could do this:

string keep_this_string;
ifstream fin( "fin.txt" );
while ( fin )
{
  fin >> "Ignore this string everywhere it occurs" >>
keep_this_string >> "Ignore something else";
  use_it( keep_this_string.c_str() );
}

How about an istream member getline() that returns a
formatted string:

istringstream iline;
iline.str( fin.getline() );
iline >> "Ignore this string everywhere it occurs" >>
keep_this_string >> "Ignore something else";
use_it( keep_this_string.c_str() );

or even just:

string ilinestr;
fin.getline( ilinestr );

Any thoughts, suggestions, instruction, direction is
most welcome.


Justin


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]