输入 和 输出 概念 :
上述 输入输出 根据 目的地 的不同 分为 三种类型:
输入 / 输出 流 的继承结构 ;
下图中 ios 是 输入 / 输出 流 基类 , 含义是 input - output - stream ;
ios 基类 有 2 个子类 , 分别是 istream 输入流 , ostream 输出流 ;
输入 / 输出 流相关头文件简介 :
在 iostream 头文件中 , 提前预定义好了 cin , cout , cerr , clog 等 输入 / 输出 流 ;
导入了 iostream 头文件 , 就可以使用上述 4 个 输入 / 输出 流 ;
__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2_IMPORT istream cin;
__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2_IMPORT ostream cout;
__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2_IMPORT ostream cerr;
__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2_IMPORT ostream clog;
上述 输入 / 输出 流 的 istream 和 ostream 的类型如下 :
using istream = basic_istream<char, char_traits<char>>;
using ostream = basic_ostream<char, char_traits<char>>;
// CLASS TEMPLATE basic_istream
template <class _Elem, class _Traits>
class basic_istream : virtual public basic_ios<_Elem, _Traits> { // control extractions from a stream buffer
// CLASS TEMPLATE basic_ostream
template <class _Elem, class _Traits>
class basic_ostream : virtual public basic_ios<_Elem, _Traits> { // control insertions into a stream buffer
basic_ios 的原型如下 , basic_ios 类 也是一个类模板 , 该类 继承 ios_base 类 ;
_STD_BEGIN
// CLASS TEMPLATE basic_ios
template <class _Elem, class _Traits>
class basic_ios : public ios_base { // base class for basic_istream/basic_ostream
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有