Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      Standard library header <ios>

      From cppreference.com
      <cpp‎ |header
       
       
      Standard library headers
       

      This header is part of theInput/Output library.

      Contents

      Includes

      Forward declarations of all classes in the input/output library[edit]

      Classes

      manages formatting flags and input/output exceptions
      (class)[edit]
      manages an arbitrary stream buffer
      (class template)[edit]
      std::iosstd::basic_ios<char>(typedef)
      std::wiosstd::basic_ios<wchar_t>(typedef)
      represents absolute position in a stream or a file
      (class template)[edit]
      (C++11)
      the IO stream error codes
      (enum)[edit]
      extends the type traitstd::is_error_code_enum to identify iostream error codes
      (class template specialization)[edit]
      represents relative file/stream position (offset from fpos), sufficient to represent any file size
      (typedef)[edit]
      represents the number of characters transferred in an I/O operation or the size of an I/O buffer
      (typedef)[edit]

      Functions

      identifies the iostream error category
      (function)[edit]
      constructs an iostream error code
      (function)[edit]
      constructs an iostream error condition
      (function)[edit]
      switches between textual and numeric representation of booleans
      (function)[edit]
      controls whether prefix is used to indicate numeric base
      (function)[edit]
      controls whether decimal point is always included in floating-point representation
      (function)[edit]
      controls whether the+ sign used with non-negative numbers
      (function)[edit]
      controls whether leading whitespace is skipped on input
      (function)[edit]
      controls whether uppercase characters are used with some output formats
      (function)[edit]
      controls whether output is flushed after each operation
      (function)[edit]
      sets the placement of fill characters
      (function)[edit]
      changes the base used for integer I/O
      (function)[edit]
      changes formatting used for floating-point I/O
      (function)[edit]

      [edit]Synopsis

      #include <iosfwd> namespace std{using streamoff=/* implementation-defined */;using streamsize=/* implementation-defined */;template<class StateT>class fpos; class ios_base;template<class CharT,class Traits= char_traits<CharT>>class basic_ios; // manipulators  ios_base& boolalpha(ios_base& str);  ios_base& noboolalpha(ios_base& str);   ios_base& showbase(ios_base& str);  ios_base& noshowbase(ios_base& str);   ios_base& showpoint(ios_base& str);  ios_base& noshowpoint(ios_base& str);   ios_base& showpos(ios_base& str);  ios_base& noshowpos(ios_base& str);   ios_base& skipws(ios_base& str);  ios_base& noskipws(ios_base& str);   ios_base& uppercase(ios_base& str);  ios_base& nouppercase(ios_base& str);   ios_base& unitbuf(ios_base& str);  ios_base& nounitbuf(ios_base& str); // adjustfield  ios_base& internal(ios_base& str);  ios_base& left(ios_base& str);  ios_base& right(ios_base& str); // basefield  ios_base& dec(ios_base& str);  ios_base& hex(ios_base& str);  ios_base& oct(ios_base& str); // floatfield  ios_base& fixed(ios_base& str);  ios_base& scientific(ios_base& str);  ios_base& hexfloat(ios_base& str);  ios_base& defaultfloat(ios_base& str); // error reportingenumclass io_errc{    stream=1}; template<>struct is_error_code_enum<io_errc>:public true_type{};  error_code make_error_code(io_errc e)noexcept;  error_condition make_error_condition(io_errc e)noexcept;const error_category& iostream_category()noexcept;}

      [edit]Classstd::ios_base

      namespace std{class ios_base{public:class failure;// see description // fmtflagsusing fmtflags=/*bitmask-type-1*/;staticconstexpr fmtflags boolalpha=/* unspecified */;staticconstexpr fmtflags dec=/* unspecified */;staticconstexpr fmtflags fixed=/* unspecified */;staticconstexpr fmtflags hex=/* unspecified */;staticconstexpr fmtflags internal=/* unspecified */;staticconstexpr fmtflags left=/* unspecified */;staticconstexpr fmtflags oct=/* unspecified */;staticconstexpr fmtflags right=/* unspecified */;staticconstexpr fmtflags scientific=/* unspecified */;staticconstexpr fmtflags showbase=/* unspecified */;staticconstexpr fmtflags showpoint=/* unspecified */;staticconstexpr fmtflags showpos=/* unspecified */;staticconstexpr fmtflags skipws=/* unspecified */;staticconstexpr fmtflags unitbuf=/* unspecified */;staticconstexpr fmtflags uppercase=/* unspecified */;staticconstexpr fmtflags adjustfield=/* see description */;staticconstexpr fmtflags basefield=/* see description */;staticconstexpr fmtflags floatfield=/* see description */; // iostateusing iostate=/*bitmask-type-2*/;staticconstexpr iostate badbit=/* unspecified */;staticconstexpr iostate eofbit=/* unspecified */;staticconstexpr iostate failbit=/* unspecified */;staticconstexpr iostate goodbit=/* see description */; // openmodeusing openmode=/*bitmask-type-3*/;staticconstexpr openmode app=/* unspecified */;staticconstexpr openmode ate=/* unspecified */;staticconstexpr openmode binary=/* unspecified */;staticconstexpr openmode in=/* unspecified */;staticconstexpr openmode out=/* unspecified */;staticconstexpr openmode trunc=/* unspecified */;staticconstexpr openmode noreplace=/* unspecified */ // seekdirusing seekdir=/*bitmask-type-4*/;staticconstexpr seekdir beg=/* unspecified */;staticconstexpr seekdir cur=/* unspecified */;staticconstexpr seekdir end=/* unspecified */; class Init; // fmtflags state    fmtflags flags()const;    fmtflags flags(fmtflags fmtfl);    fmtflags setf(fmtflags fmtfl);    fmtflags setf(fmtflags fmtfl, fmtflags mask);void unsetf(fmtflags mask);     streamsize precision()const;    streamsize precision(streamsize prec);    streamsize width()const;    streamsize width(streamsize wide); // locales    locale imbue(const locale& loc);    locale getloc()const; // storagestaticint xalloc();long&  iword(int idx);void*& pword(int idx); // destructorvirtual ~ios_base(); // callbacksenum event{ erase_event, imbue_event, copyfmt_event};using event_callback=void(*)(event, ios_base&,int idx);void register_callback(event_callback fn,int idx);     ios_base(const ios_base&)= delete;    ios_base& operator=(const ios_base&)= delete; staticbool sync_with_stdio(bool sync=true); protected:    ios_base(); private:staticint index;// exposition onlylong*  iarray;// exposition onlyvoid** parray;// exposition only};}

      [edit]Classstd::ios_base::failure

      namespace std{class ios_base::failure:public system_error{public:explicit failure(const string& msg,const error_code& ec= io_errc::stream);explicit failure(constchar* msg,const error_code& ec= io_errc::stream);};}

      [edit]Classstd::ios_base::Init

      namespace std{class ios_base::Init{public:    Init();    Init(const Init&)=default;    ~Init();    Init& operator=(const Init&)=default;private:staticint init_cnt;// exposition only};}

      [edit]Class templatestd::fpos

      namespace std{template<class StateT>class fpos{public:// members    StateT state()const;void state(stateT);private;    StateT st;// exposition only};}

      [edit]Class templatestd::basic_ios

      namespace std{template<class CharT,class Traits= char_traits<CharT>>class basic_ios:public ios_base{public:using char_type= CharT;using int_type=typename Traits::int_type;using pos_type=typename Traits::pos_type;using off_type=typename Traits::off_type;using traits_type= Traits; // flags functionsexplicit operatorbool()const;bool operator!()const;    iostate rdstate()const;void clear(iostate state= goodbit);void setstate(iostate state);bool good()const;bool eof()const;bool fail()const;bool bad()const;     iostate exceptions()const;void exceptions(iostate except); // constructor/destructorexplicit basic_ios(basic_streambuf<CharT, Traits>* sb);virtual ~basic_ios(); // members    basic_ostream<CharT, Traits>* tie()const;    basic_ostream<CharT, Traits>* tie(basic_ostream<CharT, Traits>* tiestr);     basic_streambuf<CharT, Traits>* rdbuf()const;    basic_streambuf<CharT, Traits>* rdbuf(basic_streambuf<CharT, Traits>* sb);     basic_ios& copyfmt(const basic_ios& rhs);     char_type fill()const;    char_type fill(char_type ch);     locale imbue(const locale& loc); char      narrow(char_type c,char dfault)const;    char_type widen(char c)const;     basic_ios(const basic_ios&)= delete;    basic_ios& operator=(const basic_ios&)= delete; protected:    basic_ios();void init(basic_streambuf<CharT, Traits>* sb);void move(basic_ios& rhs);void move(basic_ios&& rhs);void swap(basic_ios& rhs)noexcept;void set_rdbuf(basic_streambuf<CharT, Traits>* sb);};}

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 35C++98the prototypes ofunitbuf andnounitbuf were missing in the synopsisadded
      LWG 78C++98the type of parameterfn ofios_base::register_callback
      in the synopsis was misspecified asevent_call_back
      corrected to
      event_callback
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/header/ios&oldid=164060"

      [8]ページ先頭

      ©2009-2025 Movatter.jp