I has a blag!

Pages: 123

@Null,
I seriously doubt cmd.exe ever uses the system()
function.

True, but I believe system() calls cmd.exe.

According to http://www.cplusplus.com/reference/clibrary/cstdlib/system/
Invokes the command processor to execute a
command
Last edited on
Yeah, that's a good point. It isn't difficult to explain, though: effectively, it tells the user to press ENTER (unless 'false' is passed for 'prompt') and then waits until they do.


Yeah but the problem is with people learning what code does effectively and not what it actually says.

For example you should explain what cin.ignore() is, what parameters it takes, and then what std::numeric_limits<std::streamsize>::max() means, etc.

If I were an instructor, and a beginner used this to pause the console, I would ask them these questions, and if they had no idea, I would doc them a few points.

Last edited on
Telling someone who doesn't know why their hello world program isn't working, that they should be running their programs in the console, is not going to be helpful in my opinion.
¿Why not? Your program is working, you don't know how to execute it.
Null wrote:
True, but I believe system() calls cmd.exe.

Technically it's supposed to call "sh", but Windows has cmd.exe, so I think you're right.

iseeplusplus wrote:
If I were an instructor, and a beginner used this to pause the console, I would ask them these questions, and if they had no idea, I would doc them a few points.

Depends how far into the course they are. If it's right at the start, I'd expect them to be able to tell me approximately what it's doing. Further into the course, yes, I would expect them to understand it, even if only by inference.
¿Why not? Your program is working, you don't know how to execute it.


Because when you compile in an IDE, your program starts. It's ideal that you see your programs output at this point. I would suggest adding a breakpoint, but not reopening in a console after every time you want to recompile your program.

But also there are times when pausing is useful other than for keeping "hello world" on the screen. For example: print a set of data, pause, print next set of data etc.

Telling them to just run from the command prompt kind of blows off their question if they want to know how to add a pause.
Last edited on
If you're interested in the OS stuff, read Operating Systems: Design and Implementation by Andrew Tanenbaum & Albert Woodhull, it's excellent. It's kind of expensive, but I'm sure you can find a "free version" on a certain "the sailor port" if you are so inclined.

The second edition is $17, so if I can't find a good "sailor port" for the third edition, I might purchase the second.


Clearly people decided to ignore my let the thread die post, but since everyone seems to be playing nice now I won't whine anymore.
Last edited on
@iseeplusplus: Your program is working, your IDE is crap. (¿better?)

But also there are times when pausing is useful other than for keeping "hello world" on the screen. For example: print a set of data, pause, print next set of data etc.
That's interesting (assuming that you want input in your program)

After a drunk walk, ended with
$ ./a.out > archibaldo

# In another terminal
$ less +F archibaldo
Alternatively: ./a.out | less

That's pretty sweet. I'll have to remember that.
I cannot pass the input to my program that way, it's catch by 'less'
I must say I'm surprised nobody commented on 11, 12 and 18... and yet focused so much on 27a (whilst totally ignoring 27b).
Topic archived. No new replies allowed.
Pages: 123