std::basic_filebuf::open
Aus cppreference.com
< cpp | io | basic filebuf
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
std::basic_filebuf<CharT, Traits>* open( const char* s, std::ios_base::openmode mode ) |
(1) | |
std::basic_filebuf<CharT, Traits>* open( const std::string& s, std::ios_base::openmode mode ) |
(2) | (seit C++11) |
Öffnet die Datei, deren Name ist gegeben durch
1) Original:
Opens the file whose name is given by
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
die Null-terminierte engen Bytestring
2) s
Original:
the null-terminated narrow byte string
s
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
die Null-terminierte engen Bytestring s.c_str()
Original:
the null-terminated narrow byte string s.c_str()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Wie von anrufenden std::fopen(s, modestring), wo
modestring
wie folgt bestimmt wird:Original:
as if by calling std::fopen(s, modestring), where
modestring
is determined as follows:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
modestring
Original: modestring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
openmode & ~ate |
"r" | in
|
"w" | out , out|trunc
|
"a" | app , out|app
|
"r+" | out|in |
"w+" | out|in|trunc |
"a+" | out|in|app, in|app |
"rb" | binary|in |
"wb" | binary|out, binary|out|trunc |
"ab" | binary|app, binary|out|app |
"r+b" | binary|out|in |
"w+b" | binary|out|in|trunc |
"a+b" | binary|out|in|app, binary|in|app |
Wenn
openmode
nicht einer der aufgeführten Modi, schlägt der open()
.Original:
If
openmode
is not one of the modes listed, the open()
fails.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Wenn die offene Operation gelingt und openmode & std::ios_base::ate != 0 (die
ate
Bit gesetzt ist), positioniert die Datei Position bis zum Ende der Datei, als ob durch den Aufruf std::fseek(file, 0, SEEK_END). Wenn die Neupositionierung fehlschlägt, ruft close()
und gibt einen Null-Pointer auf Fehler hinweisen .Original:
If the open operation succeeds and openmode & std::ios_base::ate != 0 (the
ate
bit is set), repositions the file position to the end of file, as if by calling std::fseek(file, 0, SEEK_END). If the repositioning fails, calls close()
and returns a null pointer to indicate failure.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Wenn die zugehörige Datei bereits geöffnet war, gibt ein NULL-Zeiger rechts weg .
Original:
If the associated file was already open, returns a null pointer right away.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten] Parameter
s | - | der Name der Datei zu öffnen
Original: the file name to open The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
openmode | - | die Datei Öffnen-Modus, ein binäres OR der std::ios_base Modi
Original: the file opening mode, a binary OR of the std::ios_base modes 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
*this bei Erfolg ein NULL-Zeiger bei Ausfall .
Original:
*this on success, a null pointer on failure.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Notes
open()
wird in der Regel durch den Konstruktor oder open()
Elementfunktion std::basic_fstream genannt .Original:
open()
is typically called through the constructor or the open()
member function of std::basic_fstream.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten] Beispiel
This section is incomplete Reason: no example |
[Bearbeiten] Siehe auch
checks if the associated file is open (öffentliche Elementfunktion) | |
spült die Put-Bereich Puffer und schließt die zugehörige Datei Original: flushes the put area buffer and closes the associated file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) |