std::basic_filebuf::seekoff
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. |
protected: virtual pos_type seekoff( off_type off, |
||
Positioniert den Dateizeiger, wenn möglich, in die Position, die genau
off
Zeichen von Anfang, Ende, oder aktuelle Position der Datei (je nach dem Wert des way
.Original:
Repositions the file pointer, if possible, to the position that corresponds to exactly
off
characters from beginning, end, or current position of the file (depending on the value of way
.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.
Falls die zugehörige Datei nicht geöffnet ist (is_open()==false, schlägt entspricht sofort .
Original:
If the associated file is not open (is_open()==false, fails immediately.
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 Multibyte-Zeichen-Kodierung ist state-abhängige (codecvt::encoding() kehrte -1) oder variabler Länge (
codecvt::encoding()
kehrte 0) und der Offset off
nicht 0, schlägt sofort:. kann diese Funktion nicht die Anzahl von Bytes, die zu entsprechen off
Zeichen .Original:
If the multibyte character encoding is state-dependent (codecvt::encoding() returned -1) or variable-length (
codecvt::encoding()
returned 0) and the offset off
is not 0, fails immediately: this function cannot determine the number of bytes that correspond to off
characters.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
way
nicht std::basic_ios::cur oder der Offset off
nicht 0, und die meisten ärgern Betrieb auf dieser filebuf Objekt geschehen ausgegeben wurde (das heißt, entweder der Put-Puffer nicht leer ist, oder die zuletzt aufgerufene Funktion war overflow()
), ruft dann die std::codecvt::unshift unshift Sequenz notwendig zu bestimmen, und schreibt diese Sequenz in die Datei durch Aufrufen overflow()
.Original:
If
way
is not std::basic_ios::cur or the offset off
is not 0, and the most resent operation done on this filebuf object was output (that is, either the put buffer is not empty, or the most recently called function was overflow()
), then calls std::codecvt::unshift to determine the unshift sequence necessary, and writes that sequence to the file by calling overflow()
.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.
Dann wandelt das Argument
way
auf einen Wert whence
vom Typ int wie folgt:..Original:
Then converts the argument
way
to a value whence
of type int 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.
Wert
way Original: value of way The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
value of whence
|
std::basic_ios::beg | SEEK_SET |
std::basic_ios::end | SEEK_END |
std::basic_ios::cur | SEEK_CUR |
Dann, wenn das Zeichen Codierung mit fester Breite (
codecvt::encoding()
gibt einige positive Zahl width
, bewegt den Dateizeiger wie von std::fseek(file, width*off, whence) .Original:
Then, if the character encoding is fixed-width (
codecvt::encoding()
returns some positive number width
, moves the file pointer as if by std::fseek(file, width*off, whence).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.
Ansonsten bewegt den Dateizeiger wie von std::fseek(file, 0, whence) .
Original:
Otherwise, moves the file pointer as if by std::fseek(file, 0, whence).
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
openmode
Argument, das die Funktion der Basisklasse Unterschrift erforderlich , ist in der Regel ignoriert, da std::basic_filebuf
nur eine Datei Position hält .Original:
The
openmode
argument, required by the base class function signature, is usually ignored, because std::basic_filebuf
maintains only one file position.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
off | - | relativen Position, um die Position Indikator gesetzt .
Original: relative position to set the position indicator to. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||
dir | - | definiert Grundposition den relativen Offset zu bewerben. Es kann eine der folgenden Konstanten sein:
Original: defines base position to apply the relative offset to. It can be one of the following constants:
The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||
which | - | Legt fest, welche der Ein-und / oder Ausgabe-Sequenzen zu beeinflussen. Es kann eine oder eine Kombination der folgenden Konstanten:
Original: defines which of the input and/or output sequences to affect. It can be one or a combination of the following constants:
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
ist ein neu konstruiertes Objekt vom Typ pos_type die resultierende Datei Position oder pos_type(off_type(-1)) bei Ausfall speichert .
Original:
A newly constructed object of type pos_type which stores the resulting file position, or pos_type(off_type(-1)) 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
seekoff()
wird durch std::basic_streambuf::pubseekoff, die durch std::basic_istream::seekg genannt wird aufgerufen, std::basic_ostream::seekp, std::basic_istream::tellg und std::basic_ostream::tellpOriginal:
seekoff()
is called by std::basic_streambuf::pubseekoff, which is called by std::basic_istream::seekg, std::basic_ostream::seekp, std::basic_istream::tellg, and std::basic_ostream::tellpThe 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
#include <iostream> #include <fstream> #include <locale> int main() { // prepare a 10-byte file holding 4 characters in UTF8 std::ofstream("text.txt") << u8"z\u00df\u6c34\U0001d10b"; // or u8"zß水𝄋" // or "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9d\x84\x8b"; // open using a non-converting encoding std::ifstream f1("text.txt"); std::cout << "f1's locale's encoding() returns " << std::use_facet<std::codecvt<char, char, std::mbstate_t>>(f1.getloc()).encoding() << '\n' << "pubseekoff(3, beg) returns " << f1.rdbuf()->pubseekoff(3, std::ios_base::beg) << '\n' << "pubseekoff(0, end) returns " << f1.rdbuf()->pubseekoff(0, std::ios_base::end) << '\n';; // open using UTF-8 std::wifstream f2("text.txt"); f2.imbue(std::locale("en_US.UTF-8")); std::cout << "f2's locale's encoding() returns " << std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t>>(f2.getloc()).encoding() << '\n' << "pubseekoff(3, beg) returns " << f2.rdbuf()->pubseekoff(3, std::ios_base::beg) << '\n' << "pubseekoff(0, end) returns " << f2.rdbuf()->pubseekoff(0, std::ios_base::end) << '\n'; }
Output:
f1's locale's encoding() returns 1 pubseekoff(3, beg) returns 3 pubseekoff(0, end) returns 10 f2's locale's encoding() returns 0 pubseekoff(3, beg) returns -1 pubseekoff(0, end) returns 10
[Bearbeiten] Siehe auch
Beruft seekoff() Original: invokes seekoff() 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_streambuf )
| |
[virtuell] |
positioniert die Datei Position mit absoluter Adressierung Original: repositions the file position, using absolute addressing The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (virtuellen geschützten Member-Funktion) |
verschiebt die Datei Positionsanzeiger zu einer bestimmten Position in einer Datei Original: moves the file position indicator to a specific location in a file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) |