VS无法从const char[] 转换为char*
const char *errormsg[256];
errormsg[0] = (char *)malloc(20);
errormsg[0]="error command!";
errormsg[1] = (char *)malloc(20);
errormsg[1]="error parameter!";
从2017版本开始,VS给出了新的标准:不允许将指针指向一组常量!
所以,我把它改为:
char* errormsg[256];
char text1[20]="error command!";
errormsg[0] = (char*)malloc(20);
errormsg[0] = text1;
char text2[20] = "error parameter!";
errormsg[1] = (char*)malloc(20);
errormsg[1] = text2;
编译通过!