c++ - Interrupt cin while loop without the user entering input -


In the main , I give the user the ability to enter commands to stop the application:

  while (run_processes and amp; cin & gt; & gt; Kmmand_lain_input) { 

I set to stop anywhere app Wish / run_processes = false; .

However, when i would run_processes set to false , then stops without entering the above loop user input.

How can I properly interrupt the loop without entering user input?

portable way std :: cin is not possible to disrupt.

You can still solve a non-portable solution, e.g. Manually poll () standard input on a UNIX system and check run_processes while voting.


Comments

Popular posts from this blog

c++ - C/pp Sockets, recv()/send() works only under gdb -

GO: Serve static pages -

objective c - How to open front/back camera at the same time in iOS developing? -