Namensräume
Varianten
Aktionen

std::basic_stringbuf::str

Aus cppreference.com
< cpp‎ | io‎ | basic stringbuf

 
 
Input / Output-Bibliothek
I / O-Manipulatoren
C-style I / O
Puffern
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(veraltet)
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.
Abstraktionen
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
Datei-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(veraltet)
ostrstream(veraltet)
strstream(veraltet)
Types
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
Fehler Kategorie Schnittstelle
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_stringbuf
Öffentliche Member-Funktionen
Original:
Public 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_stringbuf::basic_stringbuf
basic_stringbuf::operator=(C++11)
basic_stringbuf::swap(C++11)
basic_stringbuf::str
Geschützt Member-Funktionen
Original:
Protected 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_stringbuf::underflow
basic_stringbuf::pbackfail
basic_stringbuf::overflow
basic_stringbuf::setbuf
basic_stringbuf::seekoff
basic_stringbuf::seekpos
Non-Member-Funktionen
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap(std::basic_stringbuf)(C++11)
 
std::basic_string<CharT, Traits, Allocator> str() const;
(1)
void str( const std::basic_string<CharT, Traits, Allocator>& s);
(2)
Ruft den zugrunde liegenden String .
Original:
Gets and sets the underlying string.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Erstellt und gibt einen std::basic_string Objekt mit einer Kopie dieses std::basic_stringbuf zugrunde liegenden Zeichenfolge. Für die Eingabe nur Bäche, enthält die zurückgegebene Zeichenfolge die Zeichen aus dem Bereich [eback(), egptr()). Für Eingang / Ausgang oder Ausgang nur Bäche, enthält die Zeichen aus pbase() bis zum letzten Zeichen in der Reihenfolge unabhängig von egptr() und epptr() .
Original:
Creates and returns a std::basic_string object containing a copy of this std::basic_stringbuf's underlying character sequence. For input-only streams, the returned string contains the characters from the range [eback(), egptr()). For input/output or output-only streams, contains the characters from pbase() to the last character in the sequence regardless of egptr() and epptr().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Löscht die gesamte zugrunde liegende Zeichenfolge dieses std::basic_stringbuf und konfiguriert dann einen neuen zugrunde liegenden Zeichenfolge, die eine Kopie des Inhalts s. Die Zeiger std::basic_streambuf wie folgt initialisiert:
Original:
Deletes the entire underlying character sequence of this std::basic_stringbuf and then configures a new underlying character sequence containing a copy of the contents of s. The pointers of std::basic_streambuf are initialized as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Für Input-Streams (mode & ios_base::in == true), eback() Punkten auf dem ersten Zeichen, gptr() == eback() und egptr() == eback() + s.size(): die anschließende Eingabe wird das erste Zeichen s kopiert erfahren .
Original:
For input streams (mode & ios_base::in == true), eback() points at the first character, gptr() == eback(), and egptr() == eback() + s.size(): the subsequent input will read the first character copied from s.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Für Ausgangsströme (mode & ios_base::out == true), pbase() Punkten auf dem ersten Zeichen und epptr() >= pbase() + s.size() (epptr darf weiter so hinweisen, dass die folgende sputc() nicht sofort anrufen overflow())
Original:
For output streams (mode & ios_base::out == true), pbase() points at the first character and epptr() >= pbase() + s.size() (epptr is allowed to point farther so that the following sputc() wouldn't immediately call overflow())
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Für append Streams (mode & ios_base::ate == true), pptr() == pbase() + s.size(), so dass die nachfolgende Ausgabe wird bis zum letzten Zeichen von s (seit C++11) kopiert angehängt werden
Original:
For append streams (mode & ios_base::ate == true), pptr() == pbase() + s.size(), so that subsequent output will be appended to the last character copied from s (seit C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Für no-Anhängen Output-Streams, pptr() == pbase(), so dass die nachfolgende Ausgabe die Zeichen aus s kopiert überschreiben .
Original:
For no-appending output streams, pptr() == pbase(), so that subsequent output will overwrite the characters copied from s.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Parameter

s -
ein String-Objekt hält den Ersatz Zeichenfolge
Original:
a string object holding the replacement character sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Rückgabewert

1)
Ein String-Objekt mit einer Kopie dieses Puffers zugrunde liegenden Zeichenfolge .
Original:
A string object holding a copy of this buffer's underlying character sequence.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
(None)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Notes

Diese Funktion wird in der Regel durch std::basic_stringstream::str() abgerufen .
Original:
This function is typically accessed through std::basic_stringstream::str().
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 <sstream>
#include <iostream>
int main()
{
    int n;
 
    std::istringstream in;  // could also use in("1 2")
    in.rdbuf()->str("1 2"); // set the get area
    in >> n;
    std::cout << "after reading the first int from \"1 2\", the int is " 
              << n << ", str() = \"" << in.rdbuf()->str() << "\"\n"; // or in.str()
 
    std::ostringstream out("1 2");
    out << 3;
    std::cout << "after writing the int '3' to output stream \"1 2\""
              << ", str() = \"" << out.str() << "\"\n";
 
    std::ostringstream ate("1 2", std::ios_base::ate); // C++11
    ate << 3;
    std::cout << "after writing the int '3' to append stream \"1 2\""
              << ", str() = \"" << ate.str() << "\"\n";
}

Output:

after reading the first int from "1 2", the int is 1, str() = "1 2"
after writing the int '3' to output stream "1 2", str() = "3 2"
after writing the int '3' to append stream "1 2", str() = "1 23"

[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::basic_stringstream) [edit]