std:: putchar
| 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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<cstdio>
|
||
|
int
putchar
(
int
ch
)
;
|
||
문자 ch 를 stdout 에 씁니다. 내부적으로 문자는 기록되기 직전에 unsigned char 로 변환됩니다.
std:: putc ( ch, stdout ) 와 동등합니다.
목차 |
매개변수
| ch | - | 기록될 문자 |
반환값
성공 시, 기록된 문자를 반환합니다.
실패 시, EOF 를 반환하고 stdout 에 대한 "error" 표시자를 설정합니다( std::ferror() 참조).
예제
#include <cstdio> int main() { for (char c = 'a'; c != 'z'; ++c) std::putchar(c); // putchar return value is not equal to the argument int r = 0x1024; std::printf("\nr = 0x%x\n", r); r = std::putchar(r); std::printf("\nr = 0x%x\n", r); }
가능한 출력:
abcdefghijklmnopqrstuvwxy r = 0x1024 $ r = 0x24
참고 항목
|
파일 스트림에 문자를 기록합니다
(함수) |
|
|
C documentation
for
putchar
|
|