close
Espaços nominais
Variantes
Ações

std::basic_filebuf::swap

De cppreference.com

<metanoindex/>

 
 
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_filebuf
Membro funções públicas
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_filebuf::basic_filebuf
basic_filebuf::~basic_filebuf
basic_filebuf::operator=(C++11)
basic_filebuf::swap(C++11)
basic_filebuf::is_open
basic_filebuf::open
basic_filebuf::close
Protegido funções de membro
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_filebuf::showmanyc
basic_filebuf::underflow
basic_filebuf::uflow
basic_filebuf::pbackfail
basic_filebuf::overflow
basic_filebuf::setbuf
basic_filebuf::seekoff
basic_filebuf::seekpos
basic_filebuf::sync
basic_filebuf::imbue
Não-membros funções
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.
 
<tbody> </tbody>
void swap( std::basic_filebuf& rhs )
(desde C++11)
Trocas do estado e os conteúdos de *this e rhs.
Original:
Swaps the state and the contents of *this and rhs.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Parâmetros

rhs -
outro basic_filebuf
Original:
another basic_filebuf
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

(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.

Notas

Esta função é chamada automaticamente quando a troca de objetos std::fstream, raramente é necessário chamá-lo diretamente.
Original:
This function is called automatically when swapping std::fstream objects, it is rarely necessary to call it directly.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemplo

#include <fstream>
#include <string>
#include <iostream>
 
int main()
{

    std::ifstream fin("test.in"); // read-only
    std::ofstream fout("test.out"); // write-only

    std::string s;
    getline(fin, s);
    std::cout << s << '\n'; // outputs the first line of test.in

    fin.rdbuf()->swap(*fout.rdbuf()); //swap the underlying buffers

    getline(fin, s); // fails: cannot read from a write-only filebuf
    std::cout << s << '\n'; // prints empty line

}


Veja também

(C++11)
atribui um objeto basic_filebuf
Original:
assigns a basic_filebuf object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro) [edit]
o algoritmo especializado std::swap
Original:
specializes the std::swap algorithm
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de função) [edit]
(C++11)
troca dois fluxos de arquivo
Original:
swaps two file streams
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_fstream função pública membro) [edit]