------- Comment #1 from pinskia at gcc dot gnu dot org  2007-08-06 04:56 -------
If I add a check for errors:

#include <iostream>
using namespace std;

int main() {
 cout
 << "Input in hex two integers x and y." << endl;
 int x, y;
  if(!cin)
   cout << "error" << endl;
  cin >> hex >> x >> y;
  if(!cin)
   cout << "error" << endl;
  else
    cout << "y: " << y << "x: " << x << endl;
}


----
Then I get this behavior:
Input in hex two integers x and y.
aaaaaaaa
error

If I enter less than 8 digits, it gets accepted.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++
  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            |
            Summary|cin fails to allow input to |cin and hex input (==8
                   |be entered                  |digits gets rejected)
            Version|unknown                     |3.4.6


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

Reply via email to