Conclusion in visual studio 2008

I am a new programmer in visual studio (using the 2008 version)

I have 2 questions. Maybe someone can help me with them.

  • when you run my program, it prints a selection of things, it opens cmd windos, and then closes it right away. How can I make this window stay open and not close?

  • I want to save the output to a file. I want to automatically redirect the output from the program to the txt file. How can I do it? I know that I can do this through the cmd window using sone of type '<' command .. but I need to use Visual Studio Compiler (and not gcc / g ++), is there a way to get the output to a file?

+4
source share
2 answers

On the first question, I also had problems with this. I have no real solution, but I just put:

int a; cin >> a; 

at the end of the program, causing the window to not close until I type in a number.

+2
source

1) There is no IDE option for this. You must add system("pause"); or cin.get(); at the end of your main .

+4
source

Source: https://habr.com/ru/post/1389874/


All Articles