Hi.
the problem with you code is that you are returning a local variable outside the function (out side the scope)
when a function is called, all it's local variables are created in the stack, so your buffer[2000] is in the stack, and when the function returns the local variables does not exist any more.
you can do this :
//================================================== ==========//
void PutDataInMemory(const CString &rkcstrData, char* buffer){
int nDataSize = rkcstrData.GetLength();
for(int nCounter=0; nCounter<nDataSize; nCounter++){
buffer[nCounter] = rkcstrData.GetAt(nCounter);
}
}
|