Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to convert CStringArray to a char

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hi,
How can I convert an element of a CStringArray to a char and the opposite

Thanks for help
 
Well, the cstring array has an implicit conversion so any strXXX functions can be called.

For example

char* buffer = new char[array[0].GetLength()*sizeof(TCHAR)+1];
strcpy(buffer,array[0]);

Matt
 
A CStringArray is an array of CString objects.

You need to obtain access to the appropriate CString and then use methods on the CString.
To get characters GetAt(nIndex) or the operator [].
To set characters SetAt(nIndex, ch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top