我是 C/C++ 游戏的新手,所以我认为我犯了一个菜鸟错误:
int main(){
char* clen;
clen = getenv("CONTENT_LENGTH");
if (clen==NULL){
cout << "No such ENV var: CONTENT_LENGTH"<<endl;
exit(0);
}
int cl = 0;
cl = atoi(clen);
if (cl < 1){
return inputPage();
}
// if there is no content, we assume that this is a fresh request,
// so we showed the input page, otherwise, we'll return dispatch to
//the processing code.
postTest(clen);
}
这应该是一个 CGI 脚本。据我所知,使用 GDB、打印语句等,此代码段错误位于“cl = atoi(clen);”行 我不知道为什么会这样。K&R 认为这是正确的。我基本上从其他六个在线教程中复制了这一行。它似乎在昨晚工作!我完全被难住了。