Namensräume
Varianten
Aktionen

std::basic_ifstream::basic_ifstream

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

 
 
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_ifstream
Member-Funktionen
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_ifstream::basic_ifstream
basic_ifstream::operator=(C++11)
basic_ifstream::swap(C++11)
basic_ifstream::rdbuf
Datei-Operationen
Original:
File operations
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream::is_open
basic_ifstream::open
basic_ifstream::close
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.
basic_ifstream::swap(std::basic_ifstream)(C++11)
 
basic_ifstream();
(1)
basic_ifstream( const char* filename,
                ios_base::openmode mode = ios_base::in );
(2)
basic_ifstream( const string& filename,                                  
                ios_base::openmode mode = ios_base::in );
(3) (seit C++11)
basic_ifstream( basic_ifstream&& other );
(4) (seit C++11)
basic_ifstream( const basic_ifstream& rhs) = delete;
(5)
Erzeugt neue Datei-Stream .
Original:
Constructs new file stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Standard constructor: baut einen Stream, der nicht mit einer Datei zugeordnet ist: default-konstruiert die std::basic_filebuf und baut die Basis mit dem Zeiger auf diese default-konstruiert std::basic_filebuf Mitglied .
Original:
Default constructor: constructs a stream that is not associated with a file: default-constructs the std::basic_filebuf and constructs the base with the pointer to this default-constructed std::basic_filebuf member.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Zuerst führt die gleichen Schritte wie die Default-Konstruktor, dann asssociate den Strom mit einer Datei durch den Aufruf rdbuf()->open(filename, mode | std::ios_base::in).. Wenn die open ()-Aufruf gibt einen Null-Zeiger, setzt setstate(failbit) .
Original:
First, performs the same steps as the default constructor, then asssociate the stream with a file by calling rdbuf()->open(filename, mode | std::ios_base::in).. If the open() call returns a null pointer, sets setstate(failbit).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Gleich wie basic_ifstream(filename.c_str(), mode) .
Original:
Same as basic_ifstream(filename.c_str(), mode).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Bewegen Konstruktor. Zunächst Bewegung baut die Basisklasse von other (was keinen Einfluss auf die rdbuf() Zeiger), dann bewegen-baut das std::basic_filebuf Mitglied, dann nennt this->set_rdbuf() die neue basic_filebuf als rdbuf() Zeiger in der Basisklasse installieren .
Original:
Move constructor. First, move-constructs the base class from other (which does not affect the rdbuf() pointer), then move-constructs the std::basic_filebuf member, then calls this->set_rdbuf() to install the new basic_filebuf as the rdbuf() pointer in the base class.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Der Copy-Konstruktor wird gelöscht: Diese Klasse ist nicht kopierbar .
Original:
The copy-constructor is deleted: this class is not copyable.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Parameter

filename -
der Name der Datei, die geöffnet werden kann
Original:
the name of the file to be opened
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 -
andere Datei-Stream, der als Quelle verwenden
Original:
another file 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 <fstream>
#include <utility>
#include <string>
int main()
{
std::ifstream f0;
    std::ifstream f1("test.bin", std::ios::binary);
    std::string name = "example.txt";
    std::ifstream f2(name);
    std::ifstream f3(std::move(f1));
}


[Bearbeiten] Siehe auch

öffnet eine Datei und ordnet sie mit dem Strom
Original:
opens a file and associates it with the stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(öffentliche Elementfunktion) [edit]
öffnet eine Datei und konfiguriert es wie die zugehörige Zeichenfolge
Original:
opens a file and configures it as the associated character sequence
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_filebuf) [edit]
ersetzt die rdbuf ohne Löschen seinen Fehler Zustand
Original:
replaces the rdbuf without clearing its error state
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(geschützt Member-Funktion) [edit]
Baut das Objekt
Original:
constructs the 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_istream) [edit]