std::basic_ostream<CharT,Traits>::put
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í. |
basic_ostream& put( char_type ch ); |
||
Escribe
ch caracteres en la secuencia de salida .Original:
Writes character
ch to the output stream.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.
Esta función es una función de salida sin formato: se inicia la ejecución mediante la construcción de un objeto de tipo
sentry, que vacía los buffers de salida tie()'d si es necesario y comprueba los errores de secuencia. Después de la construcción, si se devuelve el objeto centinela false, la función devuelve sin pretender ninguna salida. Si se produce una excepción durante la salida, entonces ios :: badbit se establece (se suprime la excepción a menos que exceptions()&badbit) != 0, en cuyo caso se vuelve a iniciar)Original:
This function is an unformatted output function: it begin execution by constructing an object of type
sentry, which flushes the tie()'d output buffers if necessary and checks the stream errors. After construction, if the sentry object returns false, the function returns without attempting any output. If an exception is thrown during output, then ios::badbit is set (the exception is suppressed unless exceptions()&badbit) != 0, in which case it is rethrown)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
| ch | - | carácter a escribir
Original: character to write 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
*this
Notas
Esta función no está sobrecargado para los tipos
signed char o unsigned char, a diferencia del << operador
formatoOriginal:
operator<<
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
Original:
This function is not overloaded for the types
signed char or unsigned char, unlike the formatted << operador
Original:
operator<<
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
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.
A diferencia de las funciones de salida con formato, esta función no establece el
failbit si la salida no .Original:
Unlike formatted output functions, this function does not set the
failbit if the output fails.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.
Ejemplo
Ejecuta este código
#include <fstream>
#include <iostream>
int main()
{
std::cout.put('a'); // normal usage
std::cout.put('\n');
std::ofstream s("/does/not/exist/");
s.clear(); // pretend the stream is good
std::cout << "Unformatted output: ";
s.put('c'); // this will set badbit, but not failbit
std::cout << " fail=" << bool(s.rdstate() & s.failbit);
std::cout << " bad=" << s.bad() << '\n';
s.clear();
std::cout << "Formatted output: ";
s << 'c'; // this will set badbit and failbit
std::cout << " fail=" << bool(s.rdstate() & s.failbit);
std::cout << " bad=" << s.bad() << '\n';
}
Salida:
a
Unformatted output: fail=0 bad=1
Formatted output: fail=1 bad=1
Ver también
| inserciones de datos caracter (función) | |
| Inserta un bloque de caracteres. (función miembro pública) |