Prints text in graphics mode.
#include <graph.h>
void __far _outtext( const char __far *text );
text | Text string to output |
The _outtext function outputs the null-terminated string that text points to. No formatting is provided, in contrast to the standard console I/O library routines such as printf. This function will work in any screen mode.
Text output begins at the current text position.
To output text using special fonts, you must use the _outgtext function.
None.
Standards:None
16-Bit:DOS
32-Bit:None
_outmem, _settextcolor, _settextposition, _settextwindow, _wrapon
/* OUTTXT.C: This example illustrates text output functions:
* _gettextcolor _getbkcolor _gettextposition _outtext
* _settextcolor _setbkcolor _settextposition
*/
#include <conio.h>
#include <stdio.h>
#include <graph.h>
char buffer [80];
void main( void )
{
/* Save original foreground, background, and text position */
short blink, fgd, oldfgd;
long bgd, oldbgd;
struct _rccoord oldpos;
/* Save original foreground, background, and text position. */
oldfgd = _gettextcolor();
oldbgd = _getbkcolor();
oldpos = _gettextposition();
_clearscreen( _GCLEARSCREEN );
/* First time no blink, second time blinking. */
for( blink = 0; blink <= 16; blink += 16 )
{
/* Loop through 8 background colors. */
for( bgd = 0; bgd < 8; bgd++ )
{
_setbkcolor( bgd );
_settextposition( (short)bgd + ((blink / 16) * 9) + 3, 1 );
_settextcolor( 7 );
sprintf(buffer, "Back: %d Fore:", bgd );
_outtext( buffer );
/* Loop through 16 foreground colors. */
for( fgd = 0; fgd < 16; fgd++ )
{
_settextcolor( fgd + blink );
sprintf( buffer, " %2d ", fgd + blink );
_outtext( buffer );
}
}
}
_getch();
/* Restore original foreground, background, and text position. */
_settextcolor( oldfgd );
_setbkcolor( oldbgd );
_clearscreen( _GCLEARSCREEN );
_settextposition( oldpos.row, oldpos.col );
}