std::basic_streambuf<CharT,Traits>:: sgetc
From cppreference.net
<
cpp
|
io
|
basic streambuf
C++
Input/output library
| 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)
|
std::basic_streambuf
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
int_type sgetc
(
)
;
|
||
Lee un carácter de la secuencia de entrada.
Si la posición de lectura de la secuencia de entrada no está disponible, retorna underflow() . De lo contrario retorna Traits :: to_int_type ( * gptr ( ) ) .
Contenidos |
Parámetros
(ninguno)
Valor de retorno
El valor del carácter apuntado por el get pointer .
Ejemplo
Ejecutar este código
#include <iostream> #include <sstream> int main() { std::stringstream stream("Hello, world"); std::cout << "sgetc() returned '" << (char)stream.rdbuf()->sgetc() << "'\n"; std::cout << "peek() returned '" << (char)stream.peek() << "'\n"; std::cout << "get() returned '" << (char)stream.get() << "'\n"; }
Salida:
sgetc() returned 'H' peek() returned 'H' get() returned 'H'
Véase también
|
(removed in C++17)
|
lee un carácter de la secuencia de entrada y avanza la secuencia
(función miembro pública) |
|
avanza la secuencia de entrada, luego lee un carácter sin avanzar nuevamente
(función miembro pública) |