C++ console "MORE" command

Started by
2 comments, last by Justaddwater 20 years, 1 month ago
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?
Advertisement
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.
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.
ok sounds like its a bit more complicated then i want to get into with this, so I will just use the scroll bar, thanks anyway!

This topic is closed to new replies.

Advertisement