www.delorie.com/archives/browse.cgi | search |
From: | "Randy" <umgrang0 AT cc DOT umanitoba DOT ca> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Convert String to char * |
Date: | Tue, 2 Nov 1999 21:29:36 -0500 |
Organization: | The University of Manitoba |
Message-ID: | <7voa5q$smh$1@canopus.cc.umanitoba.ca> |
References: | <7vn6sc$7fh$1 AT nnrp1 DOT deja DOT com> <7vn8q9$bog$1 AT baker DOT cc DOT tut DOT fi> |
NNTP-Posting-Host: | annex2-06.cc.umanitoba.ca |
X-Trace: | canopus.cc.umanitoba.ca 941599738 29393 130.179.153.70 (3 Nov 1999 03:28:58 GMT) |
X-Complaints-To: | Postmaster AT cc DOT umanitoba DOT ca |
NNTP-Posting-Date: | 3 Nov 1999 03:28:58 GMT |
X-Newsreader: | Microsoft Outlook Express 4.72.3110.1 |
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
Lines: | 27 |
To: | djgpp AT Delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Or .data(), I don't know the difference between that and .c_str() if any. Forsberg Sakari wrote in message <7vn8q9$bog$1 AT baker DOT cc DOT tut DOT fi>... >Nicolas Blais <nicblais AT hotmail DOT com> wrote: >> How do I convert a String to a character array *? > >errr.... I remember a function c_str() > >string tempstring = "hiiohei"; >char tempchar[20]; >strcpy( tempchar, tempstring.c_str() ); > >just remember to check if the string is short enough >or use > >int CHAR_LENGHT; >string tempstring = "hiiohei"; >char tempchar[CHAR_LENGHT+1]; >strncpy( tempchar, tempstring.c_str(), CHAR_LENGHT ); >tempchar[CHAR_LENGHT] = '\0'; > >or check string size with function size(); > >** Sakari Forsberg zacu AT cc DOT tut DOT fi ** >** Information: finger zacu AT assari DOT cc DOT tut DOT fi **
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |