delorie.com/archives/browse.cgi | search |
Newsgroups: | comp.os.msdos.djgpp |
From: | manfred DOT heumann AT uni-bielefeld DOT de (Manni Heumann) |
Subject: | Re: Convert from basic_string to char *... |
References: | <7tb6c9$770$1 AT autumn DOT news DOT rcn DOT net> <7tb715$brq$1 AT autumn DOT news DOT rcn DOT net> |
X-Newsreader: | News Xpress 2.01 |
Date: | Tue, 05 Oct 1999 07:53:48 GMT |
NNTP-Posting-Host: | dhcp33-114.uni-bielefeld.de |
Message-ID: | <37f9ae9b.0@news.uni-bielefeld.de> |
X-Trace: | 5 Oct 1999 09:54:03 +0200, dhcp33-114.uni-bielefeld.de |
Lines: | 24 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
In article <7tb715$brq$1 AT autumn DOT news DOT rcn DOT net>, "Tom" <thomasbd AT erols DOT com> wrote: >The above program didn't work,... I'm glad to hear that. >... but I still want to know how to do the bottom >one. Thanks. And also add the following to the top: > [SNIP] To convert a string to a char* just use the member function .c_str(): string s="Hello"; const char *cp; cp=s.c_str(); The char* has to be const because you are not supposed to mess with the memory that belongs to the string. -- Manni
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |