[Bug c++/33000] New: cin fails to allow input to be entered

vanemden at cs dot uvic dot ca gcc-bugzilla@gcc.gnu.org
Mon Aug 6 04:45:00 GMT 2007


linuxthing$g++ -v
Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
more main.c
#include <iostream>
using namespace std;

int main() {
  cout
  << "Input in hex two integers x and y." << endl;
  int x, y; cin >> hex >> x >> y;
}
linuxthing$more makefile
run: prog
        ./prog

prog: main.o
        g++ -o prog main.o
#       gcc -o prog main.o -lm
# -lm option to ensure sqrt gets included from math lib

main.o: main.c
        g++ -c -Wall main.c
#       gcc -c -ansi -pedantic -Wall main.c
#       gcc -c -Wall main.c

clean:
        rm -f main.o
        rm -f prog
linuxthing$make run
./prog
Input in hex two integers x and y.
aaaaaaaa
linuxthing$
-----------------
This shows the failure to allow input.
Below follows the intended behaviour as given by an earlier version of g++
-----------------
yang$g++ -v
Reading specs from
/package/gcc-2.95.2/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/specs
gcc version 2.95.2 19991024 (release)
yang$more main.c
#include <iostream>
using namespace std;

int main() {
  cout
  << "Input in hex two integers x and y." << endl;
  int x, y; cin >> hex >> x >> y;
}
yang$
run: prog
      ./prog

prog: main.o
      g++ -o prog main.o
#     gcc -o prog main.o -lm
# -lm option to ensure sqrt gets included from math lib

main.o: main.c
      g++ -c -Wall main.c
#     gcc -c -ansi -pedantic -Wall main.c
#     gcc -c -Wall main.c

clean:
      rm -f main.o
      rm -f prog
yang$make run
g++ -c -Wall main.c
g++ -o prog main.o
./prog
Input in hex two integers x and y.
aaaaaaaa
bbbbbbbb
yang$


-- 
           Summary: cin fails to allow input to be entered
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vanemden at cs dot uvic dot ca
 GCC build triplet: gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
  GCC host triplet: linux.cs.uvic.ca
GCC target triplet: linux.cs.uvic.ca


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33000



More information about the Gcc-bugs mailing list