int i;
for(i=0; i<10; i++){
printf("\r%d",);
fflush(stdout);//清除缓冲区
sleep(1);
}
运行:跟手表的秒钟一样
FILE *fp;
if ((fp = fopen("test", "wb")) == NULL)
{
printf("Cannot open file.\n");
exit(1);
}
char ch = 'i';
int i;
for(i = 0; i < 5; i++)
{
fwrite(&ch, sizeof(ch), 1, fp);
//fflush(fp);
}
fclose(fp);
fflush函数使用
最新推荐文章于 2023-09-11 15:17:26 发布