Re: [OT] What happens when you clear the screen?
- Posted by Derek Parnell <ddparnell at bigpond.com> Feb 11, 2007
- 483 views
Alex Caracatsanis wrote: > > I was reading an old book on C programming for beginners. The author made > the point that different compilers implement clearing the screen in > different ways. In an attempt to demonstrate a sort of "universal" > implementation of screen-clearing, his code printed 25 new-lines, eg: > while(i < 25) { printf("\n"); i++; } // "push" things off the screen > > I know we've got clear_screen(), so we don't need to do any of this, but it > prompted me to wonder what happens when you clear the screen. What happens > to characters that may have been "pushed over the top" of the screen? Are > they lost? Do they still exist somewhere? Can they be "brought back" into > the screen? > > I remember wondering about this in relation to the "active page" vs the > "display page" - and I don't know if these are connected with the issue > above - so I guess it's time for me to ask.. > > Any pointers in the right direction appreciated. Generally speaking, the lines "pushed off" are not retrivable unless your application saves them first. Some terminals (and we are talking character-mode apps here), hold a virtual screen buffer that you can get to using special terminal escape codes, but this is rare. In the MS-DOS world, there is a fixed amount of RAM that repesents the screen and characters moved out if this are lost. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell