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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenating a CString and a CString* array

Status
Not open for further replies.

TheCrappyProgrammer

Programmer
Sep 17, 2001
41
US
I have a problem concatenating a CString and a CString* array.
I get a "Performed an Illegal Operation" window when I try to do it.

Here's my code:

CString expression;
CString* pTOP = new CString[10];

for (int index=0;index<10;index++)
expression = expression + pTOP[index]; //This is where the problem is.

//Note: This is just a shortened version of my code.
//I already initialized all my variables and arrays in my real code.
 
Nothing wrong with your posted code. The problem maybe is in somewhere else in your original code.
 
I'm not sure, but I think what you do with
CString* pTOP = new CString[10];
is : you create 10 pTOPs.
why not avoid this problem and write
CString pTOP;
and use CString's MID-function ?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top