Namensräume
Varianten
Aktionen

std::{{{1}}}::

Aus cppreference.com


{{{1}}}( ios_base::openmode mode =
(1)
{{{1}}}( const std::basic_string<CharT,Traits,Allocator>& str,
         ios_base::openmode mode =
(2)
{{{1}}}( {{{1}}}&& other );
(3) (seit C++11)
Konstruiert neuen String-Stream .
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)
Konstruiert neuen zugrunde liegenden String-Gerät. Die zugrunde liegende basic_stringbuf Objekt wird als gebaut
Original:
Constructs new underlying string device. The underlying basic_stringbuf object is constructed as
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Verwendet eine Kopie str als ursprünglichen Inhalt des zugrunde liegenden String-Gerät. Die zugrunde liegende basic_stringbuf Objekt wird als gebaut
Original:
Uses a copy of str as initial contents of the underlying string device. The underlying basic_stringbuf object is constructed as
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Bewegen Konstruktor. Konstruiert den Datei-Stream mit dem Zustand der other mit move-Semantik .
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.

[Bearbeiten] Parameter

str -
String, der als ursprünglichen Inhalt des String-Stream verwenden
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 -
legt Stream offenen Modus. Es ist Bitmaske Typ sind die folgenden Konstanten definiert:
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
versuchen Ende Strom vor jedem Schreibvorgang
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
Öffnen Sie im Binär-Modus
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
zum Lesen öffnen
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
zum Schreiben geöffnet
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
Verwerfen der Inhalt des Stroms beim Öffnen
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
versuchen Ende Stromes unmittelbar nach geöffnet
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
versuchen Ende Strom vor jedem Schreibvorgang
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
Öffnen Sie im Binär-Modus
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
zum Lesen öffnen
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
zum Schreiben geöffnet
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
Verwerfen der Inhalt des Stroms beim Öffnen
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
versuchen Ende Stromes unmittelbar nach geöffnet
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 -
anderen String-Stream als Quelle zu verwenden
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.

[Bearbeiten] Beispiel

#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

[Bearbeiten] Siehe auch

Ruft den Inhalt der zugrunde liegenden String-Gerät Objekt
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.

(öffentliche Elementfunktion of std::{{{1}}}) [edit]
konstruiert eine basic_stringbuf Objekt
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.

(öffentliche Elementfunktion of std::basic_stringbuf) [edit]