home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_C
/
PUTCHR.ZIP
/
PUTCHR.H
< prev
Wrap
C/C++ Source or Header
|
1994-02-01
|
2KB
|
52 lines
/*
Put_Character Routine
This routine will output any character to the screen without having
to call BIOS routines. It is handy for those characters which have
both a symbol and a control feature. In particular ascii values of
seven (7) through thirteen (13), inclusively.
To use, put the following line in your source code:
#include "putchr.h"
and when you are ready to use:
{Set position and text attributes for the character.}
Put_Character( Char );
*/
#if !defined(__CONIO_H)
#include <conio.h>
#endif
void
Put_Character( char Character )
{
struct text_info Current_Window; // To get current characteristics.
char Put_Character[2]; // The character and its attribute.
int X, Y; // Screen coordinates.
// Get current display characteristics.
gettextinfo( &Current_Window );
// Put the character together with the current attributes.
Put_Character[0] = Character;
Put_Character[1] = Current_Window.attribute;
// Determine the absolute screen coordinates of the current position.
X = Current_Window.winleft + Current_Window.curx - 1;
Y = Current_Window.wintop + Current_Window.cury - 1;
// Put the character on the screen at the current position with the
// current attributes.
puttext( X, Y, X, Y, Put_Character );
// Update the current position. If not at the edge of the window, then
// just move right one character. Otherwise, go to the beginning of
// the next line.
if ( Current_Window.curx < Current_Window.winright )
gotoxy( Current_Window.curx + 1, Current_Window.cury );
else
cprintf( "\n\r" );
}