Ask coding questions

← Back to all posts
How to press enter to continue, cin.ignore doesn't work
SpartanDoge (2)

std::cout<<"Press ENTER to continue";
std::cin.ignore(); // doesn't work for some reason, it doesn't even pause
std::cout<<"Continuing";

Commentshotnewtop
SPQR (432)

I don't think you can use Enter. Enter submits what's currently in the cin field, and it doesn't submit if the field is empty. You could use <termios.h> and raw mode to achieve the same effect with a different key, however.

Geocube101 (346)

You could create a string and send std::in to the string. You don't actually use the string, but the terminal will stop to await input