Aug 4, 2008 at 5:25am
Sory, i cant read my previous reply, so i repost this message.
Hi,
I have problem. Take a look at my code:
struct myStruct{
std::string sTest;
bool bGrab;
};
myStruct *ptrStruct;
//allocate memory
if ((ptrStruct = (myStruct *)malloc(sizeof(myStruct) * (numMasterModel))) == NULL)
exit (-1);
//assign value
ptrStruct->sTest = "just test"; //<-- GENERATE RUNTIME ERROR !
ptrStruct->sTest.assign("just test"); //<-- ALSO GENERATE RUNTIME ERROR !
How to solve this problem? I'm using Microsoft Visual C++. NET 2003. Compiler points to file "iosfwd" when error rises. Please help me
My last question is, what is the difference between this code:
struct myStruct{
std::string sTest;
bool bGrab;
};
and this code:
typedef struct{
std::string sTest;
bool bGrab;
} myStruct;
Any replies appreciate...