🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14300

Re: How to assign text to a char *buffer ?

#14300
From: Colin Maharaj
Date: Wed, 20 Aug 2003 21:54
17 lines
1321 bytes


// From an AnsiString
char *s = new char [256];
AnsiString A = "Hello World";
strcpy(s, A.c_str());


// or as you asked..
strcpy(s, "a string");

Richard Yu wrote:
> 
> I have  a text string , like "a string", want to assign into a buffer,
> defined as char* buffer, how to do that ?
> thank.
Technical Details
Message-ID: <3F43EE19.3AAACE5@cablenett.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3f43e3f5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,80747dfc78851287
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-20 15:01:34 PST
Message-ID: <3F43EE19.3AAACE5@cablenett.net>
Date: Wed, 20 Aug 2003 17:54:33 -0400
From: Colin Maharaj <cbm@cablenett.net>
Reply-To: cbm@cablenett.net
X-Mailer: Mozilla 4.78 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: How to assign text to a char *buffer ?
References: <3f43e3f5$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 196.32.37.68
X-Trace: newsgroups.borland.com 1061416551 196.32.37.68 (20 Aug 2003 14:55:51 -0700)
Lines: 17
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail