我有这个代码:
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);
}
在 'arglist->fName = "comBomber";' 我收到此错误:
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.
任何人都可以帮助我吗?如何解决这个问题?
谢谢。