End Google Ads 201810 - BS.net 01 --> Hi,

In the below code ret value become invalid as it comes out of the funcation scope. can any suggest better idea to solve this.

CString ToStr()
{
CString ret = "test";
return ret;
}

void fun()
{
CString val = ToStr(); // it returns nothing (bad pointer)
}

I have compiled this code in MS VC++2005 under winxp OS.

Thanks,
Nandu