當我到了strcpy的線,我得到的strcpy System.AccessViolationException
An unhandled exception of type 'System.AccessViolationException' occurred.
Additional information: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.
char* str; char* out;
str = (char*) Marshal::StringToHGlobalAnsi(Parms["AVI"]).ToPointer();
strcpy(out, str);
Marshal::FreeHGlobal(IntPtr(str));
分配內存的長度應該是多少? – fmvpsenior 2012-07-24 17:57:50
長度應該是'(strlen(str)+ 1)* sizeof(char)'。 – tumdum 2012-07-24 18:04:02
是的,感謝捕捉,:) – AlcoJaguar 2012-07-24 18:13:51