std::basic_ostream::put
Da cppreference.com.
|
|
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
<metanoindex/>
<tbody> </tbody> basic_ostream& put( char_type ch ); |
||
Scrive
ch carattere nel flusso di output.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.
Questa funzione è una funzione di output non formattato: è avviare l'esecuzione con la costruzione di un oggetto di tipo
sentry, che svuota il buffer di uscita tie()'d, se necessario, e controlla gli errori del flusso. Dopo la costruzione, se i rendimenti sentinella oggetto false, la funzione restituisce senza tentare alcun output. Se viene generata un'eccezione durante l'uscita, poi ios :: badbit è impostato (l'eccezione è soppressa a meno exceptions()&badbit) != 0, nel qual caso viene rilanciata)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.
Parametri
| ch | - | carattere da scrivere
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. |
Valore di ritorno
*this
Note
Questa funzione non è sovraccarico per i tipi di
signed char o unsigned char, a differenza del operatore <<
formattatoOriginal:
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 operatore <<
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 differenza delle funzioni di output formattato, questa funzione non viene impostato il
failbit se l'uscita non riesce.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.
Esempio
#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';
}
Output:
a
Unformatted output: fail=0 bad=1
Formatted output: fail=1 bad=1
Vedi anche
inserisce i dati carattere Original: inserts character data The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) | |
blocchi inserti di caratteri Original: inserts blocks of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |