[ Web Proxy ]
URL:
Viewing: https://fr.cppreference.com/cpp/io/basic_stringbuf/str [Back]  [Original]

std::basic_stringbuf::str cppreference.com
cppreference.com
Espaces de noms
Variantes

std::basic_stringbuf::str

De cppreference.com

<metanoindex/>

 
 
D'entre / sortie de bibliothque
I / O manipulateurs
C-style I / O
Tampons
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 (obsolte)
Cours d'eau
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstractions
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
Fichier E / 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
Chane 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
Tableau 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 (obsolte)
ostrstream (obsolte)
strstream (obsolte)
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
Interface catgorie d'erreur
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
Fonctions membres publiques
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
Protg fonctions membres
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
Tiers fonctions
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)
 
<tbody> </tbody>
std::basic_string<CharT, Traits, Allocator> str() const;
(1)
void str( const std::basic_string<CharT, Traits, Allocator>& s);
(2)
Obtient et dfinit la chane sous-jacente .
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)
Cre et retourne un objet std::basic_string contenant une copie de cette squence std::basic_stringbuf le caractre sous-jacent. Pour l'entre-seulement les flux, la chane retourne contient les caractres de l'[eback(), egptr()) gamme. Pour les flux d'entre / sortie ou de sortie uniquement, contient les caractres de pbase() le dernier caractre de la squence indpendamment de egptr() et 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)
Supprime la squence de caractres entier sous-jacente de cette std::basic_stringbuf puis configure une nouvelle squence de caractres sous-jacent contenant une copie du contenu de s. Les pointeurs de std::basic_streambuf sont initialises comme suit:
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.
Pour les flux d'entre (mode & ios_base::in == true), eback() points au premier caractre, gptr() == eback() et egptr() == eback() + s.size(): l'entre suivante va lire le premier caractre copi partir s .
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.
Pour les flux de sortie (mode & ios_base::out == true), pbase() points au premier caractre et epptr() >= pbase() + s.size() (epptr est autoris pointer loin pour que le sputc() suivante serait pas immdiatement 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.
Pour les flux append (mode & ios_base::ate == true), pptr() == pbase() + s.size(), de sorte que la sortie suivante sera ajout au dernier caractre copi partir s (depuis C++11)
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 (depuis C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Pour aucun-ajout flux de sortie, pptr() == pbase(), de sorte que la production subsquente crasera les caractres copis partir s .
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.

Paramtres

s -
un objet chane de caractres contenant la squence de caractres de remplacement
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.

Retourne la valeur

1)
Un objet chane contenant une copie de cette squence tampon de caractre sous-jacent .
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)
(Aucun)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Notes

Cette fonction est gnralement accessible via std::basic_stringstream::str() .
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.

Exemple

#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";
}

Rsultat :

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"

Voir aussi

obtient ou dfinit le contenu de l'objet chane de priphrique sous-jacent
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.

(fonction membre publique de std::basic_stringstream) [edit]

Web Proxy Viewer  |  New URL  |  Original Page