• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <ostream>

    std::basic_ostream::write

    basic_ostream<CharT, Traits>& write(const char_type* s, streamsize n);
    

    概要

    (非書式化出力関数)ストリームへ文字の並びを出力する。

    効果

    1. sentry オブジェクトを構築する。sentry オブジェクトが失敗を示した場合、何もしない。
    2. 配列要素へのポインタ s から n 文字をストリームバッファへ出力する。
    3. 出力できなかったら、setstate(badbit) を呼び出す。

    戻り値

    *this

    #include <iostream>
    #include <cstring>
    
    int main() {
      const char* s = "Hello world\n";
      std::cout.write(s, static_cast<std::streamsize>(std::strlen(s)));
    }
    

    出力

    Hello world
    

    実装例

    TBD

    バージョン

    言語

    • C++98

    参照