I have this code:
typedef struct {
string fName;
string str;
}t;
//-------Other functions------//
void BeginTh()
{
string arg = "yes";
t *arglist;
arglist = (t*)malloc(sizeof(t));
arglist->fName = "comBomber";
arglist->str = arg;
_beginthread(startOver, 0, (void*)arglist);
free(arglist);
}
And at 'arglist->fName = "comBomber";' i get this error:
An unhandled exception of type 'System.AccessViolationException' occurred in <appname>
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Anyone can help me ? How solve this problem ?
Thanks.