Article View: alt.comp.lang.learn.c-c++
Article #455Re: Program crashes at end
From: Neal E. Coombes
Date: Fri, 31 May 2002 03:17
Date: Fri, 31 May 2002 03:17
15 lines
1502 bytes
1502 bytes
Emmanuel Delahaye wrote:
>
> > How about:
> > string(char a[])
> > {
> > head = new char[strlen(a)];
>
> head = new char[strlen(a) + 1];
>
> > strcpy(head, a);
> > }
Indeed, thanks for the catch!
Neal
Technical Details
Message-ID:
<3CF6EB58.B6F3D9B4@telus.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.telusplanet.net!news2.telusplanet.net.POSTED!53ab2750!not-for-mailReferences:
<acv9rh$sopon$1@ID-31123.news.dfncis.de> <3CF32E4B.5F6E812E@telus.net> <Xns921ED9CE8352hsnoservernet@130.133.1.4>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,807a736b2ed72881 X-Google-Attributes: gid109fba,public X-Google-Thread: 114592,807a736b2ed72881 X-Google-Attributes: gid114592,public X-Google-Thread: 114af8,807a736b2ed72881 X-Google-Attributes: gid114af8,public X-Google-ArrivalTime: 2002-05-30 20:17:41 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.telusplanet.net!news2.telusplanet.net.POSTED!53ab2750!not-for-mail Message-ID: <3CF6EB58.B6F3D9B4@telus.net> From: "Neal E. Coombes" <Neal.Coombes@telus.net> Organization: http://www.coombez.net/ X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en-GB,en MIME-Version: 1.0 Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cpp.turbocpp,comp.lang.c++ Subject: Re: Program crashes at end References: <acv9rh$sopon$1@ID-31123.news.dfncis.de> <3CF32E4B.5F6E812E@telus.net> <Xns921ED9CE8352hsnoservernet@130.133.1.4> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 15 Date: Fri, 31 May 2002 03:17:41 GMT NNTP-Posting-Host: 209.53.14.76 X-Trace: news2.telusplanet.net 1022815061 209.53.14.76 (Thu, 30 May 2002 21:17:41 MDT) NNTP-Posting-Date: Thu, 30 May 2002 21:17:41 MDT