Unformatted I/O

Requires the preprocessor directive:

 

#include <stdio.h>

 

Only works with the char data type

 

getch()

Reads a single character from stdin / the keyboard

Unbuffered, therefore immediate

identifier = getch() ;

 

getche()

Same as above buts echoes the character back to the screen

identifier = getche() ;

 

getchar()

Reads a single character from stdin / the keyboard

Echoes back to the screen

Buffered, therefore waits for Enter key to be pressed

identifier = getchar() ;

 

gets( identifier )

Same as above, reads an entire line of text (including spaces) until the Enter key is pressed

gets( identifier )  ;

 

 

putch()

Displays a single character on stdout / the screen

putch( identifier ) ;

 

putchar ()

Displays a single character on stdout / the screen

putchar ( identifier ) ;

 

puts( )

Displays a string of text (including spaces) on stdout / the screen

Automatically adds a new line n at the end of the entered string

puts( identifier ) ;

 

Leave a Reply