This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
C++ file processing
- From: Justin Findlay <farquharsoncraig at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 2 Jul 2003 16:12:31 -0700 (PDT)
- Subject: 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