🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #15350

Re: ANSI strings toewijzen aan een string object in C++.

#15350
From: Pieter
Date: Mon, 16 Oct 2000 00:00
40 lines
1872 bytes
wat 'n geluk dat de goeie ouwe C strcpy ook nog altijd werkt.

"Andy Peeters" <andy.peeters@advalvas.be> schreef in bericht
news:8scsaa$e9r$1@news1.skynet.be...
> Hi,
>
> Ik heb een tabel met ANSI C strings en die strings zou ik graag willen
> toewijzen een tabel van string objecten in C++ (onder Linux).
>
> Voorbeeldje:
>
> #include <string>
>
> // de declaraties.
> // de eerste tabel is maar een voorbeeld,
> // want eigenlijk wordt die dynamisch opgebouwd.
> char *tabel[] = {"string1", "nog eentje", "dit is de laatste"};
> string* tabel2;
>
> // nu gaan we de string tabel zelf maken.
> tabel2 = new string[3];
>
> // nu gaan we de tabel opvullen.
> for (int i = 0; i < 3; i++)
>      tabel2[i] = tabel[i];
>
> De declaraties en de creatie van de tabel (new string[]) gaan perfect.
Maar
> de assignment in de for lus wil niet werken (tijdens run-time, compileren
> gaat zonder problemen). In Linux krijg ik telkens op dat statement:
> "Segmentation fault".
>
> Iemand enig idee wat ik verkeerd doe ? Of is het gewoon mijn systeem en
moet
> ik gewoon mijn libraries opnieuw installeren ?
>
> Merci, Andy.
>
>
Technical Details
Message-ID: <8sfh9f$31fi$1@buty.wanadoo.nl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8scsaa$e9r$1@news1.skynet.be>

Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII-7-bit
X-Google-Thread: fcea4,6025f5a818d56e9c
X-Google-Attributes: gidfcea4,public
From: "Pieter" <pieter@nospam.com>
Subject: Re: ANSI strings toewijzen aan een string object in C++.
Date: 2000/10/16
Message-ID: <8sfh9f$31fi$1@buty.wanadoo.nl>
X-Deja-AN: 682157188
References: <8scsaa$e9r$1@news1.skynet.be>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
X-Complaints-To: The appropriate party according to NNTP-Posting-Host:
X-Trace: buty.wanadoo.nl 971720815 99826 212.65.42.24 (16 Oct 2000 18:26:55 GMT)
Organization: EuroNet Internet
X-MSMail-Priority: Normal
NNTP-Posting-Date: 16 Oct 2000 18:26:55 GMT
Newsgroups: be.comp.programming