| I/O manipulators | ||||
| Print functions(C++23) | ||||
| C-style I/O | ||||
| Buffers | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++20) | ||||
| Streams | ||||
| Abstractions | ||||
| File I/O | ||||
| String I/O | ||||
| Array I/O | ||||
(C++23) | ||||
(C++23) | ||||
(C++23) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
(C++98/26*) | ||||
| Synchronized Output | ||||
(C++20) | ||||
| Types | ||||
| Error category interface | ||||
(C++11) | ||||
(C++11) |
| Types and objects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <cstdio> | ||
int putchar(int ch); | ||
Writes a characterch tostdout. Internally, the character is converted tounsignedchar just before being written.
Equivalent tostd::putc(ch,stdout).
Contents |
| ch | - | character to be written |
On success, returns the written character.
On failure, returnsEOF and sets the “error” indicator (seestd::ferror()) onstdout.
#include <cstdio> int main(){for(char c='a'; c!='z';++c) std::putchar(c); // putchar return value is not equal to the argumentint r=0x1024;std::printf("\nr = 0x%x\n", r); r= std::putchar(r);std::printf("\nr = 0x%x\n", r);}
Possible output:
abcdefghijklmnopqrstuvwxyr = 0x1024$r = 0x24
| writes a character to a file stream (function)[edit] | |
C documentation forputchar | |