Sunday, July 12, 2009

Converting string to character array (C++)?

How do I convert the string held in the variable TEXT to a character array called TEXT2[30].

Converting string to character array (C++)?
strcpy( TEXT2, TEXT.c_str() );





if TEXT is a static string, or...





strcpy( TEXT2, TEXT-%26gt;c_str() );





if TEXT is a pointer to a string





Be sure that the length of TEXT is less than 30 chars, also, else results will be...unusual.

pansy

No comments:

Post a Comment