Help us understand the problem. What is going on with this article?

MacのCLionで標準入力からEOFを送る

More than 1 year has passed since last update.

環境

  • macOS 10.12.6
  • CLion 2017.3

結論

⌘+D を押す

※ショートカットはPreference->Keymapから変更可能

バグ?仕様?

vector<string> vec;
string buf;

while (cin >> buf)
    vec.push_back(buf);

for (auto s : vec)
    cout << s << endl;
a
b
c
^D

Process finished with exit code 0

コンソールで⌘+Dを押しても正常終了するが標準出力には表示されない?

解決方法

  • ⌘+Shift+A
  • Registry...
  • run.processes.with.ptyのチェックを外す
a
b
c
^D
a
b
c

Process finished with exit code 0

無事表示されるようになりました

参考

https://youtrack.jetbrains.com/issue/CPP-5704#u=1453840538340

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away