Altering Console Display

Where can I get literature on changing the way the windows console displays its information?

What if I want to clear the screen at certain inputs.
Also, my console only displays certain ammount of lines so when I print screen it only shows the latest, for example, 500 lines and not all.
closed account (1vRz3TCk)
Where can I get literature on changing the way the windows console displays its information?

http://msdn.microsoft.com/en-us/library/ms682010(v=VS.85).aspx
Thanks for the link

But honestly that is quite overwhelming. Much more mechanics behind console programming than I thought.
Okay put it this way, how do I clear the screen of console. Isnt that part of the "system" commands?
"system" commands
are deprecated, they are dangerous and resource hungry.

However if you had actually looked at the link you would have found this:

http://msdn.microsoft.com/en-us/library/ms682022%28v=VS.85%29.aspx

In which you would have found the
"system" commands
in the third line.

It took me more time to write this post than to actually find the information you needed.

Also, this website and google are your friends, I've seen this post get repeated here almost every week.
Alright, so there is no other way since the method you quoted was dangerous and resource hungry?

What do you think of that second method on that link? Is that what you would use?
Last edited on
It really depends, if you're just experimenting is not a big deal to use the system("cls") method. It just shouldn't be used in prodution code.

The second method is the optimal solution.

There also the old trick: for(int i=0; i != 300; ++i)cout<<\n;

Take a look here:

http://www.cplusplus.com/articles/4z18T05o/

There is no C++ way to clear the screen, other than scrolling the text off the screen. Changing the color of text, etc. even more so!

If you are coding for a particular platfrom, you'll need to use the platform specific code: for Windows, the links that CodeMonkey and eidge posted are what you need. For Linux you'll have to dig out the equivalent (?) X Windows/GNOME/KDE calls (any Linux programmers about?)

For slick text UIs, most people would switch to CURSES.

Or to a GUI.

Andy

P.S. For more than enough information about what to do and what not to do on Windows, see:
http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/clearing-the-tui-screen.html
(this includes why system() calls are bad).
Last edited on
Linux console works separately from the gui part of it (kde, gnome, etc).

Anyways I believe sputnik is using windows..
Topic archived. No new replies allowed.