mahmood
mahmood

Reputation: 24705

Key combination for cin.eof()

What is the input key for cin.eof() as stated in this code

while (1) {
  int i = cin.get(); 
  if (cin.eof()) 
     break;
  ...
}

In linux, I know it is CTRL+D, but that key combination doesn't work in Visual studio.

Upvotes: 1

Views: 1130

Answers (3)

Jerry Coffin
Jerry Coffin

Reputation: 490108

F6 or ctrl+z are the usual ones (with F6 usually preferred -- ctrl+z only works dependably if preceded and followed by Enter).

Upvotes: 2

bash.d
bash.d

Reputation: 13207

In Linux/Unix, Ctrl + D sends a signal (SIGQUIT) to the controlling terminal / process. This has nothing to do with cin.eof().

You can interrupt console-applications in VS using Ctrl-C, but this kills the process.

See here.

Upvotes: 1

lc.
lc.

Reputation: 116458

In a DOS/Windows console it should be Ctrl+Z.

Upvotes: 1

Related Questions