C Language and Libraries Help (clang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
PAGE.C
◄Up► ◄Contents► ◄Index► ◄Back►
─────Run-Time Library───────────────────────────────────────────────────────
/* PAGE.C illustrates video page functions including: (DOS-only)
* _getactivepage _getvisualpage _setactivepage _setvisualpage
*/
#include <conio.h>
#include <graph.h>
#include <time.h>
#include <stdlib.h>
void delay( clock_t wait ); /* Prototype */
char *jumper[4][3] = { { { "\\o/" }, { " O " }, { "/ \\" } },
{ { "_o_" }, { " O " }, { "( )" } },
{ { " o " }, { "/O\\" }, { "/ \\" } },
{ { " o " }, { " O " }, { "( )" } } };
void main()
{
short oldvpage, oldapage, page, row, col, line;
struct _videoconfig vc;
_getvideoconfig( &vc );
if( vc.numvideopages < 4 )
exit( 1 ); /* Fail for monochrome */
oldapage = _getactivepage();
oldvpage = _getvisualpage();
if( !_setvideomoderows( _TEXTBW40, 25 ) )
exit( 1 ); /* Fail if no 40-column mode */
_displaycursor( _GCURSOROFF );
/* Draw image on each page. */
for( page = 0; page < 4; page++ )
{
_setactivepage( page );
for( row = 1; row < 23; row += 7 )
{
for( col = 1; col < 37; col += 7 )
{
for( line = 0; line < 3; line++ )
{
_settextposition( row + line, col );
_outtext( jumper[page][line] );
}
}
}
}
while( !_kbhit() )
/* Cycle through pages 0 to 3. */
for( page = 0; page < 4; page++ )
{
_setvisualpage( page );
delay( 100L );
}
_getch();
/* Restore original page. */
_setvideomode( _DEFAULTMODE );
_setactivepage( oldapage );
_setvisualpage( oldvpage );
}
/* Pauses for a specified number of microseconds. */
void delay( clock_t wait )
{
clock_t goal;
goal = wait + clock();
while( goal > clock() )
;
}
-♦-