Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to build textoutput like 'man' utility

Status
Not open for further replies.

guenter

Programmer
Jul 14, 2000
16
AT
Hi,

I would like to know how to build a program which cleans its outputted text up after completition like 'man' or vi-texteditor.

when I start writing at stdout I found no chance of cleaning up the text when the program ends.
I'd like to program a behavior like vi.
( when closing vi, the shell displays the same like bevore editing a file )

unfortunately I found just sourcecode listings of the 'more' or 'less' utils which don't clean up afterwards.

Maybe can setvbuf be used to do so ???

any help welcome
thanks
günter guenter
mail: porzer_guenter@hotmail.com
 
I have a couple of suggestions for tackling this. The first (and probably best) way that comes to mind is to switch the display page. If it is a normal console, there are usually either 4 or 8 display pages. You can use a bios interrupt for this (int 10h) directly in your C program.
eg. asm {
mov ah,05h // BIOS function (set disp page)
mov al,02h // Display page
int 21h
};
OR use something like geninterrupt();
NB: This doesn't change x,y position of text cursor.

The second way (a little more difficult) is to save all current screen contents to a buffer. Again, really an assembly routine should do this. I'm sure the start of the screen data is at address B800.
That should help. Tell me any probs. Adonai :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top