名前空間
変種
操作

std::basic_filebuf::seekoff

提供: cppreference.com
< cpp‎ | io‎ | basic filebuf

 
 
入力/出力ライブラリ
I / Oのマニピュレータ
CスタイルのI / O
バッファ
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(廃止予定)
ストリーム
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
抽象化
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
ファイル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
文字列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
アレイの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(廃止予定)
ostrstream(廃止予定)
strstream(廃止予定)
タイプ
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
エラーカテゴリインターフェース
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_filebuf
パブリックメンバ関数
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
メンバ関数を保護しました
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
非メンバ関数
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.
swap(std::basic_filebuf)(C++11)
 
protected:

virtual pos_type seekoff( off_type off,
                          std::ios_base::seekdir way,

                          std::ios_base::openmode which = std::ios_base::in | std::ios_base::out );
先頭、末尾、またはファイル(offの値に応じて、現在の位置から正確に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.
関連付けられたファイルが開いていない場合(is_open()==false、即座に失敗します
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.
マルチバイト文字エンコーディング(codecvt::encoding()返さ-1)または可変長(codecvt::encoding()0返された)状態に依存しており、オフセットoff0はありませんが、すぐに失敗した場合:この関数はoffの文字に対応するバイト数を判断することはできません。
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.
waystd::basic_ios::curないか、またはオフセットoff0ではなく、最もこのfilebufでオブジェクトに対して行われる操作は、出力(つまり、どちら置くバッファが空でない場合、または最後に呼び出された関数がoverflow())となりました再送、その後呼び出しstd::codecvt::unshift場合必要に応じたunshift配列を決定し、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.
その後、次のようにタイプwayの値whenceに引数intを変換して、ファイルにそのシーケンスを書き込みます。
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.
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
そして、文字エンコーディングは、固定幅の場合(codecvt::encoding()は、いくつかの正の数widthを返し、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.
そうでなければ、の場合と同様にファイルポインタを移動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.
openmodeが1つだけのファイルの位置を保持しているため、基本クラスの関数のシグネチャが必要とするstd::basic_filebuf引数は、通常、無視されます
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.

目次

[編集] パラメータ

off -
に位置インジケータを設定するには、相対位置.
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 -
に相対的なオフセットを適用するためのベースの位置を定義します。それは、次の定数のいずれかを指定できます。
定数
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
beg
ストリームの先頭
Original:
the beginning of a stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
end
ストリームのエンディング
Original:
the ending of a stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cur
ストリームの位置インジケータの現在位置
Original:
the current position of stream position indicator
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
defines base position to apply the relative offset to. It can be one of the following constants:
定数
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
beg
ストリームの先頭
Original:
the beginning of a stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
end
ストリームのエンディング
Original:
the ending of a stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cur
ストリームの位置インジケータの現在位置
Original:
the current position of stream position indicator
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.
which -
入力および/または出力シーケンスのどれが影響するように定義しています。これは、1つまたは次の定数の組み合わせが可能です。
定数
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
in
入力シーケンスに影響を与えます
Original:
affect the input sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
out
出力順序に影響します
Original:
affect the output sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Original:
defines which of the input and/or output sequences to affect. It can be one or a combination of the following constants:
定数
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
in
入力シーケンスに影響を与えます
Original:
affect the input sequence
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
out
出力順序に影響します
Original:
affect the output sequence
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.

[編集] 値を返します

結果のファイルの位置、あるいは失敗した場合にpos_typeを格納タイプpos_type(off_type(-1))の新しく構築されたオブジェクト.
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.

[編集] ノート

seekoff()std::basic_streambuf::pubseekoffによって呼び出されstd::basic_istream::seekgによって呼び出され、 std::basic_ostream::seekpstd::basic_istream::tellg、とstd::basic_ostream::tellp
Original:
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::tellp
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

#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

[編集] も参照してください

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.

(パブリックメンバ関数of std::basic_streambuf) [edit]
[仮想]
絶対アドレスを使用して再配置され、ファイル位置、
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.

(仮想protectedメンバ関数) [edit]
ファイル位置指示子は、ファイル内の特定の場所に移動します
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.

(機能) [edit]