名前空間
変種
操作

std::basic_filebuf::setbuf

提供: 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 std::basic_streambuf<CharT, Traits>* setbuf( char_type* s, std::streamsize n )
sがNULLポインターであるとnがゼロの場合は、filebufはなりバッファリングされていない出力の、意味pbase()pptr()ヌルであり、任意の出力は直ちにファイルに送信されます.
Original:
If s is a null pointer and n is zero, the filebuf becomes unbuffered for output, meaning pbase() and pptr() are null and any output is immediately sent to file.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
それ以外の場合は、setbuf()への呼び出しは、内部を置き換え最初の要素sが指すこのstd::basic_filebufオブジェクトがバッファリングするためにその配列にnバイトまで使用することができますされているユーザが提供する文字配列.
Original:
Otherwise, a call to setbuf() replaces the internal buffer (the controlled character sequence) with the user-supplied character array whose first element is pointed to by s and allows this std::basic_filebuf object to use up to n bytes in that array for buffering.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
この関数は、仮想保護されて、それが唯一のpubsetbuf()を介して、またはstd::basic_filebufから派生したユーザー定義クラスのメンバ関数から呼ばれるかもしれない.
Original:
This function is protected virtual, it may only be called through pubsetbuf() or from member functions of a user-defined class derived from std::basic_filebuf.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

目次

[編集] パラメータ

s -
ユーザが提供するバッファまたはnullの最初のバイトへのポインタ
Original:
pointer to the first byte in the user-provided buffer or null
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
n -
ユーザが提供するバッファまたはゼロのバイト数
Original:
the number of bytes in the user-provided buffer or zero
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] 値を返します

基底クラスにキャスト*thisstd::basic_streambuf、.
Original:
*this, cast to the base class std::basic_streambuf.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集] ノート

持つバッファ(制御文字シーケンス)。この機能を使用することができる条件そして提供されたバッファが使用される方法は、実装定義で.
Original:
The conditions when this function may be used and the way in which the provided buffer is used is implementation-defined.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • GCC 4.6のlibstdc + +
    Original:
    GCC 4.6 libstdc++
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
setbuf()がファイル(そうでなければ効果がありません)に関連付けられていない場合std::basic_filebufのみ呼び出すことができます。ユーザー提供でバッファは、ファイルからの読み取りはn-1バイト一度.
Original:
setbuf() may only be called when the std::basic_filebuf is not associated with a file (has no effect otherwise). With a user-provided buffer, reading from file reads n-1 bytes at a time.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Clangの+ 3.0のlibc + +
    Original:
    Clang++3.0 libc++
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
setbuf()ファイルを開いた後に呼ばれるかもしれないが、任意のI / O(そうでなければ、クラッシュすることがあります)の前に読み込まれます。ユーザー提供のバッファを持つ、ファイルからの読み込みが4096の最大の倍数を読み取りバッファに収まら.
Original:
setbuf() may be called after opening the file, but before any I/O (may crash otherwise). With a user-provided buffer, reading from file reads largest multiples of 4096 that fit in the buffer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Visual Studio 2010のその
    Original:
    Visual Studio 2010
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
setbuf()いくつかのI / Oが行われた後でも、いつでも呼び出すことができます。バッファの現在の内容があれば、その失われ.
Original:
setbuf() may be called at any time, even after some I/O took place. Current contents of the buffer, if any, are lost.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
標準では、すべてのI / Oが行われている前に呼び出さsetbuf(0, 0)は、バッファなしの出力.
Original:
The standard does not define any behavior for this function except that setbuf(0, 0) called before any I/O has taken place is required to set unbuffered output.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

読書のための10Kバッファを提供します。 Linux上では、straceユーティリティーは、実際に読み込んだバイト数を観察するために使用されるかもしれません
Original:
provide a 10k buffer for reading. On linux, the strace utility may be used to observe the actual number of bytes read
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <fstream>
#include <iostream>
#include <string>
int main()
{
        int cnt=0;
        std::ifstream file;
        char buf[10241];
        file.rdbuf()->pubsetbuf(buf, sizeof buf);
        file.open("/usr/share/dict/words");
        for(std::string line; getline(file, line); )
                cnt++;
        std::cout << cnt << '\n';
}


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

setbuf()を呼び出します
Original:
invokes setbuf()
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:
sets the buffer and its size for a file stream
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]