Archived

This topic is now archived and is closed to further replies.

C++ console "MORE" command

This topic is 5019 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am displaying many entries to the screen, I know that there is a system command; system ("MORE") That make info display one screen at a time but when i put that line in my derived print all functions I just get a blank screen, when I put it before my print all function in main I get a blank screen, and when I put it in my virtual print all function in my base class it has no effect... any ideas?

Share this post


Link to post
Share on other sites
Don''t call more within your program. The correct way to do it is to launch your program like so: myprog | more. | is the pipe character; it''s probably on the same key as backslash. This has to be executed from a DOS prompt/terminal, not from within your program. It will do this for *everything* output to the terminal by your program, however, and not just specific sections.

How it works: The standard output (stdout, cout, printf) from myprog is "piped" into the standard input (stdin, cin, gets?) of more. more then pages whatever comes in.

Unix machines use the concept of piping (and redirection) extensively. Unfortunately, Windows lacks a nice, native shell.

Share this post


Link to post
Share on other sites
One thing you can do is open more as a child process, redirect the console handles so that it''s standard input is equal to the parent''s standard output, and wait for the child process to terminate. How you would do this is operating system dependent, however.

Share this post


Link to post
Share on other sites