🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #3624

Reason for Segmentation Fault ??

#3624
From: Roger S
Date: Sat, 20 Jul 2002 21:51
22 lines
1466 bytes
I have a linked list class that stores a list of strings.  I have an insert
function that takes a string argument and inserts that string in into the
list.  My insert function works properly until I attempt to read a file
using:

getline(myfile, mystring)
mylist.insert(mystring)

This generates a segmentation fault:

string mystring = "Hello";
mylist.insert(mystring);

This works fine.  So does this:

mystring = "Hello, my name is Jeff";
list.insert(mysting);
Insert will also work if I read a file without getline() so I'm assuming the
problem is with getline().

Can anyone tell me what's special about a
string returned with getline()?
Technical Details
Message-ID: <3d39dbb5_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,399a523676a51144,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2002-07-20 15:04:43 PST
From: "Roger S" <halusa@erols.com>
Newsgroups: borland.public.cppbuilder.database.ado
Subject: Reason for Segmentation Fault ??
Date: Sat, 20 Jul 2002 17:51:18 -0400
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 66.44.40.51
Message-ID: <3d39dbb5_1@dnews>
X-Trace: dnews 1027201973 66.44.40.51 (20 Jul 2002 14:52:53 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews