zoukankan      html  css  js  c++  java
  • 非缓冲 和 全缓冲

    非缓冲 和 全缓冲
    非缓冲:不需要flush函数刷新,直接从缓冲区自动补上了

    #include<stdio.h>
    #include<stdlib.h>

    int main(){
           printf( "%d ", *(stdin ->_ptr)); //打印换成区内容  -> 0
           printf( "%d ", stdin ->_cnt);//缓冲区还有多少个字节
           char ch = getchar();        //输入123 会把1提走 缓冲区剩余23 注意缓冲区大小为3 因为末尾有回车
           printf( "%p ", stdin ->_ptr);
           printf( "%c ", *(stdin ->_ptr));
           printf( "%d ", stdin ->_cnt);
           char ch2 = getchar();       //会把2提走 缓冲区剩余3 注意缓冲区大小为2 因为末尾有回车
           printf( "%p ", stdin ->_ptr);
           printf( "%c ", *(stdin ->_ptr));
           printf( "%d ", stdin ->_cnt);
           system( "pause");
           return 0;
    }



    全缓冲:读取文件的时候,需要flush函数刷新










  • 相关阅读:
    自定义UILabel,使文字居左上显示
    xcode 7 运行项目报错 -fembed-bitcode is not supported on versions of iOS prior to 6.0
    git 如何删除本地未提交的文件
    coco2d-x技术
    mac 查看端口是否被使用
    ios 提交
    oc基础复习10-OC的id
    oc基础复习09-OC的self 和super(深入理解)
    oc基础复习08-OC的类方法
    oc基础复习07-OC的弱语法(转)
  • 原文地址:https://www.cnblogs.com/ZhangJinkun/p/4531468.html
Copyright © 2011-2022 走看看