运行debug是出错

来源:百度知道 编辑:UC知道 时间:2024/06/17 06:44:36
他弹出一个窗口说,C:\WINDOWS\system32\debug.exe NTVDM CPU 遇到无效的指令。然后就要求关闭或者忽略该应用程序。 请问什么回事,哪位帮我解决?

[code=C/C++] char *nm1 = new char[24];//这里我觉得没有问题啊,但是每次运行的时候到这里就出问题,后来调试查看说指针*nm1错误.....
if (nm1 == NULL) {
std::cerr < < "memory Distribution error!" < < std::endl;
exit(1);
} else {
std::cout < < "pesonal::name = \t";
cin.get();//清除流中的回车
cin.getline(nm1,24,'&');
^^^^^^^^^^^^^^^^^^^^^^

strcpy(name,nm1);
}
code]
标出来的这句有问题,最后一个参数'&'是将'&'作为行结束符。如果输入之后加个&就往下执行了。