Thursday, November 20, 2008

Restrict the program's output to a specific screen region

58. How to restrict the program's output to a specific screen region?
Ans: A C function window( ) can be used to restrict the screen output to a specific region. The window( ) function defines a text-mode window. The parameters passed to this function defines the upper-left and lower-right corner of the region within which you want the output. In the following program, the string 'Hello!' gets printed within the specified region. To print the string we must use cprintf( ) function which prints directly on the text-mode window.


#include 
main( )
{
int i, j ;
window ( 20, 8, 60, 17 ) ;
for ( i = 0 ; i <>
for ( j = 0 ; j <>
cprintf ( "Hello!" ) ;
}

No comments:

Blog List