This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Where is 'ios'/'ios_base'?


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello:

I'm using g++ with libstdc++ 2.96-69 (courtesy of Red Hat), and I was just 
wondering if the "ios" header file is missing?

I'm using a stringstream with which I'd like to throw an exception if the 
failbit/badbit is set.  I have:

  #include <iostream>
  #include <sstream>
  using namespace std;

  stringstream ss;
  ss.exceptions(ios_base::badbit | ios_base::failbit);

But on compilation I get:

  demo.cpp:25: `ios_base' undeclared (first use this function)

I have tried including <ios> as was suggested by several people on 
EFNet's #c++ channel, but I get the error, "No such file or directory".  I 
can not find an 'ios' header file.

Also, I'm wondering if I'm doing something wrong with stringstream.  While 
this is probably not the proper place to ask, the following code does 
*not* act as I expect:

  ss << argv[1];    // Move the command line argument into the string stream
  ss >> total;      // And move it's integer equivalent to total!

(total is an int).

I was hoping that the code above would take a numeric command line 
argument and convert it to an integer, storing it in total.  Basically,
the "c++ equivalent" of 'total = atoi(argv[1])'.  I was surprised to find 
the failbit set.  ;-)

Thank you in advance for your assistance.

- --------------< LINUX: The choice of a GNU generation. >--------------
Steve Frampton    <frampton@interq.or.jp>     interQ (Japan), Inc.
Systems Administrator/Software Developer      http://www.interq.or.jp/
GNU Privacy Guard ID: D055EBC5  (see http://www.gnupg.org for details)
GNU-PG Fingerprint: EEFB F03D 29B6 07E8 AF73  EF6A 9A72 F1F5 D055 EBC5

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (SunOS)
Comment: For info see http://www.gnupg.org

iD8DBQE6idhnmnLx9dBV68URAi7qAJ43yry3LFF4pwGDz3q61jZM9FeNogCgmG1Y
iuOeKTTs1+8nM5oEK1m1BR0=
=MTqn
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]