🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.lib.bug
Article #572

Run-time error when using 'get' with an istream object

#572
From: Jose Cordova
Date: Wed, 07 Feb 1990 23:28
25 lines
1137 bytes
I am having trouble using the 'get' method for the 'istream' class.
It generates a 'Segmentation fault' error at run-time.  I know the
'istream' is being opened correctly because reading into a 'String'
object with >> works fine.  Am I doing something wrong ?
The sample program and "data" illustrate the point:

main()
{
    istream from("data",io_readonly,a_useonly);
    char *line;

    from.get(line,15);
    cout << line;
}

Sample "data" file contents:
word1 word2
word3

Other relevant information:
SunOS 4.0.3         libg++ version 1.35.0        g++ version 1.35.0

Jose Cordova, CS Dept., Mississippi State Univ., jose@larry.cs.msstate.edu
   
 
Technical Details
Message-ID: <9002072328.AA07167@CSServer.CS.MsState.Edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!uunet!bu.edu!bu-cs!snorkelwacker!tut.cis.ohio-state.edu!CSSERVER.CS.MSSTATE.EDU!jose

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!uunet!bu.edu!bu-cs!snorkelwacker!tut.cis.ohio-state.edu!CSSERVER.CS.MSSTATE.EDU!jose
From: jose@CSSERVER.CS.MSSTATE.EDU (Jose Cordova)
Newsgroups: gnu.g++.lib.bug
Subject: Run-time error when using 'get' with an istream object
Message-ID: <9002072328.AA07167@CSServer.CS.MsState.Edu>
Date: 7 Feb 90 23:28:57 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 25