Article 59X6T Trying to write a C or C++ program on linux that exits with a keypress

Trying to write a C or C++ program on linux that exits with a keypress

by
Al99
from LinuxQuestions.org on (#59X6T)
Hi all, I'm new to programming and I'm new to linux and I've been experimenting with c++ and enjoying it. I'm coming up against a bit of a dead end though when trying to write a c++ program that exits a loop and shuts down the program in the terminal when a key is pressed, say escape or 'q' for example, I tried getch but it didn't work and the only other thing that was suggested was to embed assembler which I couldn't find any information about, so there it is, can anyone advise me how to make a c++ program that exits on a keypress in linux? Thanks.latest?d=yIl2AUoC8zA latest?i=uPKB9cPsQE4:YaVWscJGK0k:F7zBnMy latest?i=uPKB9cPsQE4:YaVWscJGK0k:V_sGLiP latest?d=qj6IDK7rITs latest?i=uPKB9cPsQE4:YaVWscJGK0k:gIN9vFwuPKB9cPsQE4
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments