cin - reading empty line;

This is a discussion on cin - reading empty line; within the C++ Programming forums, part of the General Programming Boards category; Hi,
I would like to read an empty line. I would like an effect which is similar to:
Code:
cout ...

Shadowsora15: that isnt possible. if you #include <iostream> cin.get() will be there. you just have to either "using namespace std;' or put "std::" before cin like so
std::cin.get();
it will be there though on any standard compiler.

shadowsora15 : Really really really bad suggestion there. cin.get() is standard and system() can only be evil. Never ever use system().

system() is standard too, only the "pause" part is not.

However, I see nothing wrong with using system("pause") in some situations.

If you don't need portable code then it's a method that is simple and works as expected. You guys mentioned cin.get() but you didn't mention how if your stream is in a fail state cin.get() will fail or if there are leftover chars in the stream, the program will just continue on.

Another concern is security, but if someone has replaced pause on your system, then they could just have easily replaced your program. Besides, if someone is replacing programs on your system, it's already too late.

Finally, efficiency is the last criticism I hear, "you're spawning a new process to pause your current process", ok, but I ask, how efficiently do I need to pause my program? The tiny bit of resources used to pause my program is a small price to pay for the ease of use, especially for someone new to programming.

I would say there are no absolutes, do what's best for a given situation, which sometimes means using system() or gotos or macros or non-portable code

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell