Hi gdkevin,
The StringArray is just an array of standard C text strings (char *). So you just need to use standard C text strings in the array.
For "CString", I assume you are referring to MFC CString. It is a Microsoft proprietary data structure, and the underlying text string is a TCHAR *.
You may use one of the following methods to convert "TCHAR *" to standard C text string "char *".
(a) You can use Microsoft's method to convert "TCHAR *" to standard C text string "char *". If your MFC is set to MBCS mode, you can just cast the "TCHAR *" to "char *". If your MFC is set to UNICODE mode, you may use WideCharToMultiByte to convert the "TCHAR *" to "char *".
(b) ChartDirector also has a utility to convert TCHAR to UTF8 (a UTF8 text string is a "char *" text string). If you use the ChartDirector utility, the code would be like:
for (int i=0;i<numw;i++)
{
str=app->m_well.MyWell[i]->name; //AfxMessageBox(str);
labels.data[i]=strdup(TCHARtoUTF8((TCHAR *)str));
}
As strdup is used, please remember to free to data afterwards to avoid memory leak.
Hope this can help.
Regards
Peter Kwan |