This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Problems with cin.getline on solaris 2.x
- To: mikas493 at student dot liu dot se, gcc-bugs at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Subject: Re: Problems with cin.getline on solaris 2.x
- From: Nathan Neulinger <nneul at umr dot edu>
- Date: Tue, 20 Mar 2001 18:40:31 -0600
- References: <F349BC4F5799D411ACE100D0B706B3BB3426D9@umr-mail03.cc.umr.edu> <001601c0b19d$8800a7a0$70eaec82@ryd.student.liu.se>
It's not me doing it. It's students and faculty. I'm just passing along
a reproducible failure.
If I change that to #include <iostream>, I have to add 'using namespace
std;', and it makes no difference to the end result. Still fails.
That syntax may be deprecated, but there is still a LOT of code out
there using it, and a lot of books that list it the old way as well.
Thanks for the attempt though.
-- Nathan
mikas493@student.liu.se wrote:
>
> Hello
> Is there a reason for using the old, deprecated <iostream.h> when you should
> use
> <iostream>? You might want to test your program using <iostream> instead.
>
> Good luck!
>
> ----- Original Message -----
> From: "Neulinger, Nathan R." <nneul@umr.edu>
> To: <libstdc++@gcc.gnu.org>; <gcc-bugs@gcc.gnu.org>
> Sent: Tuesday, March 20, 2001 9:18 PM
> Subject: Problems with cin.getline on solaris 2.x
>
> >
> > I am running the latest (03/20/01) cvs for the 3.0 branch. The following
> > code does not work properly on solaris builds. You have to hit enter
> twice,
> > and it only gets the first character of the entered string.
> >
> > ---cut---
> > #include <iostream.h>
> > int main() {
> > char str[50];
> > while (cin.getline(str,40))
> > cout << "string = \"" << str << "\"" << endl;
> > }
> > ---cut---
> >
> > ---run on sol 2.7---
> > arstest(37)> ./getln
> > fred
> >
> > string = "f"
> > ---cut---
> >
> > or
> >
> > ---run on sol 2.7 piped---
> > arstest(40)> echo fred | ./getln
> > string = "f"
> > arstest(41)>
> > ---
> >
> > ---run on linux and any other box---
> > infinity(97)>./getln
> > fred
> > string = "fred"
> > infinity(98)>
> > ---cut---
> >
> > I have this problem on sol 2.6, sol 2.7, but not on HP-UX 10.20, 11.X, or
> > linux.
> >
> > GCC is built with binutils 2.10.1.0.7, with the following options:
> >
> > ---
> > #!/bin/sh
> > # This file was generated automatically by configure. Do not edit.
> > # This directory was configured as follows:
> > /afs/umr.edu/software/egcs3/src/gcc-latest/configure
> > --with-gcc-version-trigger=
> > /afs/.umr.edu/software/egcs3/src/gcc/gcc/version.c
> > --host=sparc-sun-solaris2.7 -
> > -prefix=/afs/umr.edu/software/egcs3/install/solaris27 --with-gnu-as
> > --with-gnu-l
> > d --disable-nls --disable-checking --disable-shared --disable-libtool-lock
> > --wit
> > h-local-prefix=/afs/umr.edu/software/egcs3/install/solaris27/local
> > --enable-vers
> > ion-specific-runtime-libs --norecursion
> > # using "mh-frag"
> > ---
> >
> > I believe this was reported fixed in bug number 1620, but it still occurs
> > for me, and from the looks of the bug report, was also still occuring for
> > the person who reported it then but the problem was closed regardless.
> >
> > Any suggestions? I've attached the .s.bz2, .cpp, and .ii.bz2 files.
> >
> > -- Nathan
> >
> > ------------------------------------------------------------
> > Nathan Neulinger EMail: nneul@umr.edu
> > University of Missouri - Rolla Phone: (573) 341-4841
> > Computing Services Fax: (573) 341-4216
> >
> >
--
------------------------------------------------------------
Nathan Neulinger EMail: nneul@umr.edu
University of Missouri - Rolla Phone: (573) 341-4841
CIS - Systems Programming Fax: (573) 341-4216