• 非缓冲 和 全缓冲


    非缓冲 和 全缓冲
    非缓冲:不需要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函数刷新










  • 相关阅读:
    struts2.3.15之文件上传与下载
    hibernate4.2.4之环境搭建与测试实例
    spring4.0.0之环境搭建
    struts2.3.15之表单提交与表单验证
    iptables详解说明
    lvs+keepalived+application部署(只使用两台机器)
    Linux的awk 中的while do-while for循环
    Linux下 expect 使用详解与实例
    Linux shell批量执行scp脚本工具
    Linux服务器TIME_WAIT进程的解决与原因
  • 原文地址:https://www.cnblogs.com/ZhangJinkun/p/4531468.html
Copyright © 2020-2023  润新知