Re: Convert string to char

From: Chris \( Val \) (chrisval_at_bigpond.com.au)
Date: 02/03/04


Date: Wed, 4 Feb 2004 00:06:44 +1100


"KPR" <kpruppel@optonline.net> wrote in message news:401F9935.9010705@optonline.net...
| In C++, is there any way to convert a string to a *type char* array, in
| other words,
|
| convert "string mystring;" into "char chrarray[4];"

# include <cstring>
std::strcpy( chrarray, StdString.c_str() );

Be sure to check that you have correctly sized
'chrarray' before proceeding though.

Cheers.
Chris Val