V
V
vari0us2015-01-02 00:32:38
C++ / C#
vari0us, 2015-01-02 00:32:38

Correct non-closing windows console window?

Already tired of this ..
Before, I just wrote
cin.get () cin.get(
)
got tired of
system(“pause”)
getch()
is also a crutch !
What else do you have ?
Ideally, to write quit from the keyboard to exit
. How is this solved in serious projects?
PS Visual Studio 2015

Answer the question

In order to leave comments, you need to log in

5 answer(s)
G
GavriKos, 2015-01-02
@GavriKos

It is with such crutches that it is decided. The input is read, parsed for commands, and these same commands are executed.
In general, the program usually closes immediately when it has done everything that was asked of it in the parameters. Look at the behavior of the same ping - it does not wait for any exit command from you. Pinged and returned control to the console.

D
deathor, 2016-01-24
@deamentor

There really is such a possibility. This is done in the project settings as follows: ea2aae0c5f864d269681d17038f3e5bf.jpg
When you run the project without debugging (Ctrl + F5), the desired result will be achieved.

R
romy4, 2015-01-02
@romy4

In general, yes, they answered correctly above: completed - finish the job. Constant reading loop std::cin

A
abcd0x00, 2015-01-02
@abcd0x00

How it dares in serious projects?

Get yourself Linux.
Before, I just wrote
cin.get()
cin.get()
got
system(“pause”)
getch()
was also a crutch !

This is only needed in Windows.

H
HeBonpoc, 2016-01-15
@HeBonpoc

And why did you decide that these are crutches? Why should your program just hang and not close if it's not doing anything? If not all threads have worked, you need to wait for the threads. If the program starts something on a timer, then it needs some kind of command to close from the user => listen to input. Everything is logical, what are you missing?
And drive abcd0x00 in the neck, Linux came here to advertise, but the same thing there) Programs work according to the same principles here and there, and I haven’t heard something that they could just hang. In any case, he would have said so, and not just "left Linux here."

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question