C programming language - ch7 - Input and Output
Home |
Table of Contents
1 7.1 Standard input and output
#include <stdio.h>
int getchar(void)
returns the next input character each time it is called, or EOF when it encounters end of file. Then symbolic constant EOF is defined in <stdio.h>
int putchar(int)
puts the character c on the standard output. Returns the character written, or EOF is an error occurs.
Calls to putchar and printf may be interleaved.
printf
A width or precision may be specified as *, in which case the value is computed by converting the next argument (which must be an int). Foe example, to print at moast max characters from a string s :
printf("%.*s", max, s);
The function sprintf does the same conversions as printf does, but stores the output in a string
int sprintf(char *string, char *format, arg1, arg2, …);