Espaços nominais
Variantes
Acções

Diferenças entre edições de "cpp/io/basic stringstream/str"

Da cppreference.com
m (uma edição: Translate from the English version)
m (r2.7.3) (Robô: A adicionar: de, en, fr, zh)
Linha 1: Linha 1:
 
{{page template|cpp/io/basic_stringstream/str|basic_stringstream}}
 
{{page template|cpp/io/basic_stringstream/str|basic_stringstream}}
  
 +
 +
 
[[es:cpp/io/basic stringstream/str]]
 
[[es:cpp/io/basic stringstream/str]]
 +
 
[[it:cpp/io/basic stringstream/str]]
 
[[it:cpp/io/basic stringstream/str]]
 
[[ja:cpp/io/basic stringstream/str]]
 
[[ja:cpp/io/basic stringstream/str]]
 
[[ru:cpp/io/basic stringstream/str]]
 
[[ru:cpp/io/basic stringstream/str]]
 +

Revisão das 19h37min de 2 de novembro de 2012

 
 
De entrada / saída da biblioteca
I / O manipuladores
C estilo de I / O
Buffers
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(obsoleta)
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.
Abstrações
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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.
Cordas 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.
Matriz de 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.
(obsoleta)
(obsoleta)
(obsoleta)
Tipos
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Interface de categoria de erro
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.
(C++11)
 
std::basic_stringstream
Funções de membro
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_stringstream::basic_stringstream
basic_stringstream::operator=
basic_stringstream::swap
basic_stringstream::rdbuf
Seqüência de operações
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_stringstream::str
 
std::basic_string<CharT,Traits,Allocator> str() const;
(1)
void str(const std::basic_string<CharT,Traits,Allocator>& new_str);
(2)
Gerencia o conteúdo do objeto de cadeia subjacente.
Original:
Manages the contents of the underlying string object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Retorna uma cópia da seqüência subjacente, como se chamando rdbuf()->str().
Original:
Returns a copy of the underlying string as if by calling rdbuf()->str().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Substitui o conteúdo da seqüência subjacente, como se chamando rdbuf()->str(new_str).
Original:
Replaces the contents of the underlying string as if by calling rdbuf()->str(new_str).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

Parâmetros

new_str -
novos conteúdos da seqüência subjacente
Original:
new contents of 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.

Valor de retorno

1)
uma cópia do objeto seqüência subjacente.
Original:
a copy of the underlying string object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
(Nenhum)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemplo

#include <sstream>
#include <iostream>
int main()
{
    int n;
 
    std::istringstream in;  // could also use in("1 2")
    in.str("1 2");
    in >> n;
    std::cout << "after reading the first int from \"1 2\", the int is "
              << n << ", str() = \"" << in.str() << "\"\n";
 
    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);
    ate << 3;
    std::cout << "after writing the int '3' to append stream \"1 2\""
              << ", str() = \"" << ate.str() << "\"\n";
}

Saída:

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"

Veja também

substitui ou obtém uma cópia da seqüência de caracteres associado
Original:
replaces or obtains a copy of the associated character string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::basic_stringbuf função pública membro) [edit]