public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/3750: stream input operator>> fails in g++ 3.0
@ 2001-07-20 9:46 jddahl
0 siblings, 0 replies; only message in thread
From: jddahl @ 2001-07-20 9:46 UTC (permalink / raw)
To: gcc-gnats
>Number: 3750
>Category: c++
>Synopsis: stream input operator>> fails in g++ 3.0
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 20 09:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Jeff Dahl
>Release:
>Organization:
>Environment:
SunOS 5.6 Generic_105181-25 sun4m sparc SUNW,SPARCstation-20
>Description:
ANY TEXT FILE:
public class HelloWorld
{
public static void main(String [] args)
{
System.out.println("Hello");
}
}
CODE SOURCE:
#include <iostream>
#include <string>
#include <fstream>
using std::string;
using std::cerr;
using std::cout;
using std::endl;
using std::ifstream;
using std::ios;
int main( int argc, char *argv[] )
{
string fileArg;
ifstream inFile( "/u/jddahl/HelloWorld.java", ios::in );
if( !inFile )
{
cerr << "File could not be opened" << endl;
}
while( !inFile.eof( ))
{
//getline( inFile, fileArg );
inFile >> fileArg;
cout << "[" << fileArg << "]" << endl;
}
return 0;
}
OUTPUT WITH g++ -V 3.0:
{jddahl}67> g++ -V 3.0 test.cpp
{jddahl}68> a.out
[public class Hello]
[orld
{
public static void main(]
[tring ]
[] args)
{
]
[ystem.out.println("Hello");
}
}
]
OUTPUT WITH g++ -V 2.95.3:
{jddahl}69> g++ -V 2.95.3 test.cpp
{jddahl}70> a.out
[public]
[class]
[HelloWorld]
[{]
[public]
[static]
[void]
[main(String]
[[]]
[args)]
[{]
[System.out.println("Hello");]
[}]
[}]
[}]
g++ -V 3.0 output is all messed up-- dropping letters,
grabbing whitespace etc.
>How-To-Repeat:
compile the source file with g++ -V 2.95.3 and g++ -V 3.0 and
compare the output.
>Fix:
use getline and strtok each line
>Release-Note:
>Audit-Trail:
>Unformatted:
gcc version 3.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-07-20 9:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-20 9:46 c++/3750: stream input operator>> fails in g++ 3.0 jddahl
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).