【发布时间】:2017-09-04 08:27:28
【问题描述】:
以here 为例。
相关代码:
char line[chat_message::max_body_length + 1];
while (std::cin.getline(line, chat_message::max_body_length + 1))
{
chat_message msg;
msg.body_length(std::strlen(line));
std::memcpy(msg.body(), line, msg.body_length());
msg.encode_header();
c.write(msg);
}
c.close();
t.join();
应用程序立即退出,无需等待我输入聊天消息。 我没有对代码进行任何修改,期望使用 Windows 而不是控制台应用程序(我仍在使用 Alloc&AttachConsole 附加控制台)
【问题讨论】:
标签: c++ console std cin getline