operator>><div class="t-tr-text">(Std :: basic_istream)<div class="t-tr-dropdown"><div><div><div class="t-tr-dropdown-arrow-border"></div><div class="t-tr-dropdown-arrow"></div><div class="t-tr-dropdown-h">Original:</div><div class="t-tr-dropdown-orig">(std::basic_istream)</div><div class="t-tr-dropdown-notes">The text has been machine-translated via [http://translate.google.com Google Translate].<br/> You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.</div></div></div></div></div>
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
template< class CharT, class Traits > basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>& st, CharT& ch ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, signed char& ch ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, unsigned char& ch ); |
(1) | |
template< class CharT, class Traits> basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>& st, CharT* s ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, signed char* s ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, unsigned char* s ); |
(2) | |
template< class CharT, class Traits, class T > basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>&& st, T& value ); |
(3) | (desde C++11) |
Realiza operaciones de entrada de caracteres .
Original:
Performs character input operations.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
1)
Extractos de un personaje y lo almacena en
ch .Original:
Extracts a character and stores it to
ch.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
Extrae caracteres sucesivos y los almacena en lugares sucesivos de una matriz de caracteres cuyo primer elemento es apuntado por
s. La extracción se detiene si una de las condiciones siguientes:Original:
Extracts successive characters and stores them at successive locations of a character array whose first element is pointed to by
s. The extraction stops if one of the following conditions are met:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- un carácter de espacio (como se determina por la faceta ctype<CharT>) se encuentra. El espacio en blanco no se extrae .Original:a whitespace character (as determined by the ctype<CharT> facet) is found. The whitespace character is not extracted.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. this->width() - 1caracteres se extraenOriginal:this->width() - 1characters are extractedThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
En cualquier caso, un carácter nulo adicional
CharT() valor se almacena en el extremo de la salida .Original:
In either case, an additional null character value
CharT() is stored at the end of the output.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
3)
Llama al operador de extracción adecuado, dada una referencia a un objeto rvalue flujo de entrada (equivalente a
st >> value) .Original:
Calls the appropriate extraction operator, given an rvalue reference to an input stream object (equivalent to
st >> value).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Notas
Las versiones (1-2) de la operadora se comportan como funciones de entrada con formato'. Es decir, construir un objeto
sentry al principio que vacía el empate () 'd tampones si es necesario, el control de errores, así como extractos y descarta todos los principales espacios en blanco a menos que la bandera ios_base :: skipws fue absuelto. La entrada se trató sólo si el objeto sentry devuelve true .Original:
The (1-2) versions of the operator behave as formatted input functions. That is, they construct a
sentry object at the beginning that flushes the tie()'d buffers if needed, checks for errors, and extracts and discards all leading whitespace characters unless the ios_base::skipws flag was cleared. The input is attempted only if the sentry object returns true.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Parámetros
| st | - | flujo de entrada para extraer los datos de
Original: input stream to extract the data from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| ch | - | referencia a un carácter para almacenar el carácter extraídos
Original: reference to a character to store the extracted character to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| s | - | puntero a una cadena de caracteres para almacenar los caracteres extraídos
Original: pointer to a character string to store the extracted characters to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Valor de retorno
st
Ejemplo
Ejecuta este código
#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
std::string input = "n greetings";
std::istringstream stream(input);
char c;
const int MAX = 6;
char cstr[MAX];
stream >> c >> std::setw(MAX) >> cstr;
std::cout << "c = " << c << '\n'
<< "cstr = " << cstr << '\n';
double f;
std::istringstream("1.23") >> f; // rvalue stream extraction
std::cout << "f = " << f << '\n';
}
Salida:
c = n
cstr = greet
f = 1.23
Ver también
| extraer datos con formato (función miembro pública) |