This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problems with cin.getline on solaris 2.x
- To: "'libstdc++ at gcc dot gnu dot org'" <libstdc++ at gcc dot gnu dot org>, "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
- Subject: Problems with cin.getline on solaris 2.x
- From: "Neulinger, Nathan R." <nneul at umr dot edu>
- Date: Tue, 20 Mar 2001 14:18:16 -0600
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
getln.s.bz2
getln.ii.bz2
getln.cpp