MFCQuery
2006-05-22 13:39:27 UTC
Hi,
I am facing a problem in returning a array type variable from a function.
Suppose i have following structure.
struct MyArray:public CArray<CString,CString>
{
};
I have a function say function1 from which i want to return MyArray.So the
function declaration is like
MyArray function1()
{
MyArray Object;
//I add some strings to Object and return it
return Object;
}
And in my main program i call function 1 as
MyArray &Obj=function1();
After executing this statement i see that Obj doesn't contain those strings
which i add in function1. The size of Obj is zero.
Can someone tell me how can i return a CArray type from a function?
Thanks
I am facing a problem in returning a array type variable from a function.
Suppose i have following structure.
struct MyArray:public CArray<CString,CString>
{
};
I have a function say function1 from which i want to return MyArray.So the
function declaration is like
MyArray function1()
{
MyArray Object;
//I add some strings to Object and return it
return Object;
}
And in my main program i call function 1 as
MyArray &Obj=function1();
After executing this statement i see that Obj doesn't contain those strings
which i add in function1. The size of Obj is zero.
Can someone tell me how can i return a CArray type from a function?
Thanks