I am writing simple command line programs using Visual Studio 2017 Community and compiling and linking through the Developer Command Prompt. My question is, is there a setting that adds an extra newline when the program is finished. For example:
What I would like to happen is for a newline to only be output when I actually give the command to do so, instead of the prompt doing it for me. Thus, this is what I would like:
cout << "Hello World\n";
Hello World
<command prompt here>
Again, is there a setting that I can change to reflect this?
No, that behavior comes from either cmd.exe or conhost.exe. There's no way to change it. If I run your first version on a Linux machine I get Hello Worldhelios@linux:~$
With your second version I get Hello World
helios@linux:~$
For what it's worth, IMO a program sending output to stdout should always send a newline as the final character before exiting regardless of the platform, unless there's a very compelling reason not to do that.
Thank you for your reply. I also was trying to emulate the output in a Unix/Linux environment. So I guess I'll just have to live with it. Way to go Microsoft......