An array of LPWSTR pointers, not working right.
Posted
by BigBirdy
on Stack Overflow
See other posts from Stack Overflow
or by BigBirdy
Published on 2010-04-05T04:55:56Z
Indexed on
2010/04/05
5:03 UTC
Read the original article
Hit count: 294
Declare:
LPWSTR** lines= new LPWSTR*[totalLines];
then i set using:
lines[totalLines]=&totalText;
SetWindowText(totalChat,(LPWSTR)lines[totalLines]);
totalLines++;
Now I know totalText is right, cause if i SetWindowText using totalText it works fine. I need the text in totalLines too.
I'm also doing:
//accolating more memory.
int orgSize=size;
LPWSTR** tempArray;
if (totalLines == size) {
size *= 2;
tempArray = new LPWSTR*[size];
memcpy(tempArray, lines,sizeof(LPWSTR)*orgSize);
delete [] lines;
lines = tempArray;
}
to allocate more memory when needed.
My problem is that the lines is not getting the right data. It works for the first time around then it get corrupted. I thought at first i was overwriting but totalLines is increase. Hopefully this is enough information.
© Stack Overflow or respective owner