output will show only the end.

Hello everybody.
I really thank you for helping me to go back to programming in C++. You know I am now 73 years old. They told me I have to stay busy to stay healthy.
I am running a c++ program; the problem is the output will show only the end. The beginning of the output is lost.
Last edited on
A simple solution is to send the output to a file, so you can examine it later. Your operating system already has this capability, so you don't need to modify your program to do it. When you run your program, simply add a redirection at the end of your command, like so:
your_program > output.txt
Then you can read output.txt with any text editor.

Keep in mind that if your program is interactive (i.e. if it asks for input once it has started running) you will not be able to see the prompts, which will make the program much more difficult to use. If this is the case, you'll need to modify your program to send output to a file instead of (or as well as) the console.
Last edited on
You can change the size of the scrollback buffer to be some large number.
Properties->Layout->Screen buffer size.

As your output fills the screen, scroll bars appear and you can review output from earlier in the program.
On Linux you can pipe the output to the less command. Then you'll be able to scroll through the output using the up and down arrow keys or page up and page down.

./your_program | less

Unfortunately it seems to make the input you type invisible, but it works great for non-interactive programs.
Last edited on
For Windows you can use:

<progname> | more

This will cause a prompt to continue after 1 screen has been displayed.
TO SEEPLUS : Thanks. Can you give more details
What exactly do you want to know? Let's say your terminal/cmd has 100 lines of buffer. If you print 101 lines of output, then line 1 will be gone.

What 'more' does is it only prints output up the height of your terminal, and you have to press Enter to show more. This gives you a chance to read the information at your own pace.
Last edited on
Registered users can post here. Sign in or register to post.