fflush()在C语言中有什么用? [英] What is the use of fflush() in C language?

查看:116
本文介绍了fflush()在C语言中有什么用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在c语言中使用 fflush()的功能是什么。

i知道fflush()函数刷新缓冲区但是很难理解 stdout stdin 的主要概念以及 fflush()

给出 fflush的任何示例( stdout)



我尝试过:



what is the use fflush() function in c language.
i know fflush() function flushes the buffer but am confusing to understand the main concept with stdout and stdin along with fflush()
give any example for fflush(stdout)

What I have tried:

#include <stdio.h> 
#include<stdlib.h> 
int main() 
{ 
    char str[20]; 
    int i; 
    for (i=0; i<10; i++) 
    { 
        scanf("%[^\n]s", str); 
        printf("%d.  %s\n",i, str); 
//         fflush(stdin); 
    } 
    return 0; 
} 

推荐答案

fflush(stdout) - Google搜索 [ ^ ]和 fflush | Microsoft Docs [ ^ ]


这篇关于fflush()在C语言中有什么用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆