public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/33000] cin and hex input (==8 digits gets rejected)
Date: Mon, 06 Aug 2007 04:57:00 -0000	[thread overview]
Message-ID: <20070806045623.27943.qmail@sourceware.org> (raw)
In-Reply-To: <bug-33000-14944@http.gcc.gnu.org/bugzilla/>



------- 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	other threads:[~2007-08-06  4:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-06  4:45 [Bug c++/33000] New: cin fails to allow input to be entered vanemden at cs dot uvic dot ca
2007-08-06  4:57 ` pinskia at gcc dot gnu dot org [this message]
2007-08-06  4:59 ` [Bug libstdc++/33000] cin and hex input (==8 digits gets rejected) pinskia at gcc dot gnu dot org

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20070806045623.27943.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).