Namespace
Varianti

std::basic_ostringstream::basic_ostringstream

Da cppreference.com.

 
 
Ingresso / libreria di output
I / O manipolatori
C-style I / O
Buffer
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(deprecato)
Streams
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Astrazioni
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
File I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
String I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Array I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(deprecato)
ostrstream(deprecato)
strstream(deprecato)
Tipi
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Errore categoria interfaccia
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_ostringstream
Membri funzioni
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostringstream::basic_ostringstream
basic_ostringstream::operator=
basic_ostringstream::swap
basic_ostringstream::rdbuf
String operazioni
Original:
String operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ostringstream::str
 
basic_ostringstream( ios_base::openmode mode = ios_base::out );
(1)
basic_ostringstream( const std::basic_string<CharT,Traits,Allocator>& str,
                     ios_base::openmode mode = ios_base::out );
(2)
basic_ostringstream( basic_ostringstream&& other );
(3) (dal C++11)
Costruisce nuovo flusso di stringa.
Original:
Constructs new string stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Costruisce nuovo dispositivo sottostante stringa. L'oggetto basic_stringbuf sottostante è costruito come basic_stringbuf<Char,Traits,Allocator>(mode | ios_base::out).
Original:
Constructs new underlying string device. The underlying basic_stringbuf object is constructed as basic_stringbuf<Char,Traits,Allocator>(mode | ios_base::out).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Utilizza una copia di str come contenuto iniziale del dispositivo stringa sottostante. L'oggetto basic_stringbuf sottostante è costruito come basic_stringbuf<Char,Traits,Allocator>(str, mode | ios_base::out).
Original:
Uses a copy of str as initial contents of the underlying string device. The underlying basic_stringbuf object is constructed as basic_stringbuf<Char,Traits,Allocator>(str, mode | ios_base::out).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Sposta costruttore. Costruisce il flusso di file con lo stato di other usando la semantica si muovono.
Original:
Move constructor. Constructs the file stream with the state of other using move semantics.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Parametri

str -
stringa da utilizzare come contenuto iniziale del flusso di stringa
Original:
string to use as initial contents of the string stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
mode -
specifica modalità di apertura flusso. E 'tipo di maschera di bit, le seguenti costanti sono definite:
Constant
Original:
Constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Explanation
app
cercano alla fine del flusso prima di ogni scrittura
Original:
seek to the end of stream before each write
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
binary
aperto in modalità binaria
Original:
open in binary mode
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
in
aprire per la lettura
Original:
open for reading
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
out
aperto per la scrittura
Original:
open for writing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
trunc
scartare il contenuto del flusso durante l'apertura
Original:
discard the contents of the stream when opening
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ate
cercano di fine flusso subito dopo aperto
Original:
seek to the end of stream immediately after open
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
specifies stream open mode. It is bitmask type, the following constants are defined:
Constant
Original:
Constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Explanation
app
cercano alla fine del flusso prima di ogni scrittura
Original:
seek to the end of stream before each write
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
binary
aperto in modalità binaria
Original:
open in binary mode
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
in
aprire per la lettura
Original:
open for reading
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
out
aperto per la scrittura
Original:
open for writing
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
trunc
scartare il contenuto del flusso durante l'apertura
Original:
discard the contents of the stream when opening
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ate
cercano di fine flusso subito dopo aperto
Original:
seek to the end of stream immediately after open
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click 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.
other -
un altro flusso stringa da utilizzare come fonte
Original:
another string stream to use as source
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Esempio

#include <iostream>
#include <sstream>
int main()
{
    // default constructor (input/output stream)
    std::stringstream buf1;
    buf1 << 7;
    int n = 0;
    buf1 >> n;
    std::cout << "buf1 = " << buf1.str() << " n = " << n << '\n';
 
    // input stream
    std::istringstream inbuf("-10");
    inbuf >> n;
    std::cout << "n = " << n << '\n';
 
    // output stream in append mode (C++11)
    std::ostringstream buf2("test", std::ios_base::ate);
    buf2 << '1';
    std::cout << buf2.str() << '\n';
}

Output:

buf1 = 7 n = 7
n = -10
test1

[modifica] Vedi anche

ottiene o imposta il contenuto di oggetto sottostante dispositivo stringa
Original:
gets or sets the contents of underlying string device object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(membro pubblico funzione) [edit]
costruisce un oggetto basic_stringbuf
Original:
constructs a basic_stringbuf object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(membro pubblico of std::basic_stringbuf funzione) [edit]