早上好,
我对 C/C++ 开发人员的 Eclipse IDE 有疑问.
I have a problem with Eclipse IDE for C/C++ Developers.
我正在编写一个用于转换字符串的小工具.在某个点进行测试时 eclipse 停止提供控制台输出.例如:cout<<"test";
不显示.
I'm writting a smal tool for converting Strings. While testing on some point eclipse stopped to give console output.
e.g.:
cout<<"test";
doesn't get displayed.
但它并非无处不在......另一个例子:
But it's not every where... another example:
// File path as argument
int main(int argc, char* argv[]) {
if (argc != 2) {
cout
<< "ERROR: Wrong amount of arguments! Only one allowed...
";
cout << "
" << "Programm closed...
";
exit(1);
}
CommandConverter a(argv[1]);
cout<<"test";
a.getCommandsFromCSV();
cout<<"test2";
return 0;
}
如果缺少参数,错误消息会正确显示.但是如果参数存在并且程序继续测试输出:
The error message is displayed correctly if the argument is missing. But if the argument is there and the program continues the test outputs:
cout<<"测试";
cout<<"test2";
cout<<"test";
cout<<"test2";
不显示...
我遗漏了一些明显的东西?
are not displayed...
I am missing something obvious?
提前致谢!
你需要用换行符结束输出字符串,例如:`cout <<测试 "``.原因是标准输出被缓冲并且缓冲区在换行时被刷新.可能有一种方法可以在不输出换行符的情况下刷新 cout 缓冲区,但我不知道.可能包括对底层流缓冲区的访问(通过 rdbuf 方法).
You need to end output strings with newline, e.g.: `cout << "test "``. The reason is that the standard output is buffered and the buffer is flushed on newline. There probably exists a way to flush the cout buffer without outputting a newline, but I don't know it by heart. Probably includes access to the underlying streambuf (via the rdbuf method).
这篇关于cout 上没有控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
Eclipse 的 Visual Studio Ctrl+Tab 和 Ctrl+Shift+Tab 等效项Eclipse#39;s Visual Studio Ctrl+Tab and Ctrl+Shift+Tab Equivalent(Eclipse 的 Visual Studio Ctrl+Tab 和 Ctrl+Shift+Tab 等效项)
如何防止 Eclipse 在包资源管理器中显示打开的文How to prevent Eclipse from showing the opened file in package explorer(如何防止 Eclipse 在包资源管理器中显示打开的文件)
XML 解析器返回意外的令牌错误和空指针异常XML Parser Returning unexpected token error and null pointer exception(XML 解析器返回意外的令牌错误和空指针异常)
Java 解析 XML 文档给出“Prolog 中不允许的内容&qJava parsing XML document gives quot;Content not allowed in prolog.quot; error(Java 解析 XML 文档给出“Prolog 中不允许的内容.错误)
如何在 Eclipse 中将源附加到 Google Drive API 或“AHow to attach source to Google Drive API or `Android Private Library` in Eclipse(如何在 Eclipse 中将源附加到 Google Drive API 或“Android Pr
Lint:如何忽略“<key>"未翻译成&Lint: How to ignore quot;lt;keygt; is not translated in lt;languagegt;quot; errors?(Lint:如何忽略“lt;keygt;未翻译成lt;语言gt;错误?)