std:: fputc, std:: putc
| 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definido en el encabezado
<cstdio>
|
||
|
int
fputc
(
int
ch,
std::
FILE
*
stream
)
;
int putc ( int ch, std:: FILE * stream ) ; |
||
Escribe un carácter ch al flujo de salida dado stream .
Internamente, el carácter se convierte a unsigned char justo antes de ser escrito.
En C, putc ( ) puede implementarse como una macro, lo cual no está permitido en C++. Por lo tanto, las llamadas a std :: fputc ( ) y std :: putc ( ) siempre tienen el mismo efecto.
Contenidos |
Parámetros
| ch | - | carácter a escribir |
| stream | - | flujo de salida |
Valor de retorno
En caso de éxito, retorna el carácter escrito.
En caso de fallo, devuelve EOF y establece el indicador de error (ver std::ferror() ) en el stream .
Ejemplo
#include <cstdio> int main() { for (char c = 'a'; c != 'z'; c++) std::putc(c, stdout); // el valor de retorno de putchar no es igual al argumento int r = 0x102A; std::printf("\nr = 0x%x\n", r); r = std::putchar(r); std::printf("\nr = 0x%x\n", r); }
Salida posible:
abcdefghijklmnopqrstuvwxy r = 0x102A * r = 0x2A
Véase también
|
escribe un carácter a
stdout
(función) |
|
|
Documentación C
para
fputc
,
putc
|
|