public inbox for
help / color / mirror / Atom feed
Subject: libstdc++/10800: Locale problems prevent streams from recognizing whitespaces
Date: Thu, 15 May 2003 13:06:00 -0000	[thread overview]
Message-ID: <> (raw)

>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
>Originator:     Fernando Vega Higuera
>Release:        gcc version 3.2.2 / gcc version 3.3 20030512 (prerelease)
P4 - 1GB RAM
Linux Suse 7.2
Linux 2.4.4-4GB
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;
	cout << " false ]" << endl;


  return true;
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]
None that i know.

             reply	other threads:[~2003-05-15 13:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-15 13:06 Fernando.Vega.Higuera [this message]
2003-05-15 16:09 paolo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).