我想用多个命令来实现一个服务器。大多数命令工作到目前为止,只不过我希望服务器在客户端向quit命令写入参数时向客户端发送警告。 (I.E.退出xyz)并让用户再次尝试,而不是退出服务器。不幸的是,服务器退出用户是否输入退出或退出参数。为什么我的Do While循环终止?
bool done = false;
do
{
if(strcmp(cmd, "quit") == 0)
{
if(strcmp(argument, "") != 0)
strcpy(replyMsg, "504 Command not implemented for that parameter.\n");
else
{
strcpy(replyMsg,"221 Service closing control connection.\n");
done = true;
}
}
while(strcmp(cmd, "quit") != 0 && done != true);
正确'{''} –
您可能会缺少一个} – BlackBear
缺少大括号做循环的大括号) –