libstdc++/10800: Locale problems prevent streams from recognizing whitespaces
Fernando.Vega.Higuera@informatik.uni-erlangen.de
Fernando.Vega.Higuera@informatik.uni-erlangen.de
Thu May 15 13:52:00 GMT 2003
>Number: 10800
>Category: libstdc++
>Synopsis: Locale problems prevent streams from recognizing whitespaces
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 15 13:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Fernando Vega Higuera
>Release: gcc version 3.2.2 / gcc version 3.3 20030512 (prerelease)
>Organization:
>Environment:
P4 - 1GB RAM
Linux Suse 7.2
Linux 2.4.4-4GB
>Description:
The following code recognizes whitespaces when using
gcc 3.0.
The reported versions of gcc don't recognize whitespaces.
This behavior prevents streams from reading strings word
by word. Thereby, the whole data gets readed if a
string is retrieved from the stream.(eg. cin >> myString;)
bool ParseFile(const char* fileName)
{
if( !fileName )
return false;
ifstream inFile( fileName );
if( !inFile )
return false;
inFile >> noskipws;
char aChar;
while( !inFile.eof() )
{
inFile >> aChar;
cout << aChar << "[";
if( isspace( aChar, inFile.getloc() ) )
cout << " true ]" << endl;
else
cout << " false ]" << endl;
}
inFile.close();
return true;
}
>How-To-Repeat:
The main program is this one:
int main(int argc, char* argv[])
{
cout << "Result: " << ParseFile( argv[1] ) << "." << endl;
return 0;
}
Compile with:
g++ -ggdb -o runMe main.cpp
Run with:
runMe [your_text_file]
>Fix:
None that i know.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list