_putch

Description

Writes a character to the console.

#include <conio.h> Required only for function declarations  

int _putch( int c );

c Character to be output  

Remarks

The _putch function writes the character c directly (without buffering) to the console.

Return Value

The function returns c if successful, and EOF if not.

Compatibility

Standards:None

16-Bit:DOS

32-Bit:DOS32X

See Also

_cprintf, _getch, _getche

Example

/* GETCH.C: This program reads characters from the keyboard until it

* receives a 'Y' or 'y'.

*/

#include <conio.h>

#include <ctype.h>

void main( void )

{

int ch;

_cputs( "Type 'Y' when finished typing keys: " );

do

{

ch = _getch();

ch = toupper( ch );

} while( ch != 'Y' );

_putch( ch );

_putch( '\r' ); /* Carriage return */

_putch( '\n' ); /* Line feed */

}

Output

Type 'Y' when finished typing keys: Y