I need to feed an existing methode with a pointer to a char array,
but the type Im working with is a CString. So Ive come up with the idea of transforming the string into a char array:
int len = sMagnumName.GetLength();
char szName[ ACWN_KURZSTRING_LAENGE ]; // 128
for( int il = 0; il < len; il++ )
szName[il] = sMagnumName[il];
which works fine, except for the next time the function is called in a loop. szName still holds the old chars. So if sMagnumName is longer the first time it is passed, than the second time, the first chars in szName are replaced but the other remain.
sMagnumName first time = "pooltable", second time "bummer" szName is:
Anyone with an answer?
Deleting all chars in a loop when Im done, doesnt seem right?
for( long iC = 0; iC < ACWN_KURZSTRING_LAENGE; iC++ )
szName[iC] = NULL;