当前位置: 首页 > news >正文

东莞人才市场现场招聘会地址seo站群优化

东莞人才市场现场招聘会地址,seo站群优化,仿牌网站流量,wordpress兼容手机吗文章目录 1.文件缓冲区1.1介绍1.2缓冲文件系统1.3冲刷函数fflush1.4认识linux下的缓冲区 2.linux小程序的实现2.1 回车\r和换行\n2.2倒计时程序2.3进度条小程序sleep/usleep代码运行结果 1.文件缓冲区 1.1介绍 为缓和 CPU 与 I/O 设备之间速度不匹配,文件缓冲区用以…

文章目录

  • 1.文件缓冲区
    • 1.1介绍
    • 1.2缓冲文件系统
    • 1.3冲刷函数fflush
    • 1.4认识linux下的缓冲区
  • 2.linux小程序的实现
    • 2.1 回车\r和换行\n
    • 2.2倒计时程序
    • 2.3进度条小程序
      • sleep/usleep
      • 代码
      • 运行结果

1.文件缓冲区

1.1介绍

为缓和 CPU 与 I/O 设备之间速度不匹配,文件缓冲区用以暂时存放读写期间的文件数据而在内存区预留的一定空间。使用文件缓冲区可减少读取硬盘的次数。

1.2缓冲文件系统

系统自动地在内存为程序中每一个正在使用的文件开辟一块文件缓冲区。

  • 从内存向磁盘输出数据,先送到内存中的缓冲区,缓冲区装满后一起输送到磁盘上。
  • 从磁盘向计算机读入数据,从磁盘文件中读取数据输入到内存缓冲区(充满缓冲区),从缓冲区逐个地将数据送到程序数据区(程序变量等)。
  • 缓冲区的大小根据C编译系统决定。

1.3冲刷函数fflush

int fflush( FILE *stream );
将缓冲区内数据写到stream 指定文件。
成功返回 0 
错误返回 EOF 
高版本vs无法使用
fclose关闭文件时也会刷新缓冲区#include <stdio.h>
#include <windows.h>
int main() 
{FILE* pf = fopen("test7.txt", "w");if (!pf){perror(fopen);return 1;}fputs("abcdef", pf); //数据输出到buffer//此时文件中无内容Sleep(10000);        //睡眠10sfflush(pf);          //刷新缓冲区Sleep(10000);        //睡眠10s//此时数据到达文件fclose(pf);pf = NULL;return 0;
}

1.4认识linux下的缓冲区

在这里插入图片描述

在这里插入图片描述
在linux下gcc编译这两段代码时 结果是不同的 左边先输出后睡眠 右边先睡眠后输出

c语言不是从上到下一行一行执行的吗?

确实是的 实际上printf先于sleep执行但是sleep执行完后这个程序才结束 才会输出信息

为什么执行流到printf时 不直接显示以及为什么左边加了换行就能先显示?

c语言存在输出缓冲区(一段内存空间) 显示器设备一般的刷新策略是行刷新 即碰到\n就把\n之前的所有的字符显示出来 所以左边代码先显示 后边代码存入到缓冲区 直到程序结束才显示

当一个程序执行会自动打开stdin srdout stderr三个标准IO流

在这里插入图片描述

如何在没有换行符的情况下让他执行到printf时就显示?

在这里插入图片描述

#include <stdio.h>
#include<unistd.h>
int main()
{printf("hello linux!");fflush(stdout);sleep(3);return 0
}

2.linux小程序的实现

2.1 回车\r和换行\n

在这里插入图片描述

老式键盘的Enter: 实际上是 换行+回车[C语言中的\n也是]

在这里插入图片描述

#include <stdio.h>
#include<unistd.h>
int main()
{int count = 5;while(count){printf("count是: %d\n",count);count--;sleep(1);return 0;}
}

可以正常输出

#include <stdio.h>
#include<unistd.h>
int main()
{int count = 5;while(count){printf("count是: %d\r",count);count--;sleep(1);return 0;}
}

不输出任何内容

2.2倒计时程序

#include <stdio.h>
#include<unistd.h>
int main()
{int count = 5;while(count){printf("count是: %d\r",count);fflush(stdout);count--;sleep(1);return 0;}
}

每执行一次printf 将要输出的信息输出到缓冲区 当执行fflush函数时 将信息从缓冲区刷到显示器 之后\r回车 光标回到行首 count–

2.3进度条小程序

sleep/usleep

在这里插入图片描述

在这里插入图片描述

代码

在这里插入图片描述

运行结果

linu-vim-c-bar


文章转载自:
http://ekalead.dtrz.cn
http://multicide.dtrz.cn
http://dabster.dtrz.cn
http://congius.dtrz.cn
http://convertaplane.dtrz.cn
http://datcha.dtrz.cn
http://spirituality.dtrz.cn
http://boycott.dtrz.cn
http://kraurotic.dtrz.cn
http://tusk.dtrz.cn
http://aggeus.dtrz.cn
http://morganite.dtrz.cn
http://rencontre.dtrz.cn
http://jizz.dtrz.cn
http://erring.dtrz.cn
http://declared.dtrz.cn
http://kituba.dtrz.cn
http://kpelle.dtrz.cn
http://restiform.dtrz.cn
http://lade.dtrz.cn
http://theoretician.dtrz.cn
http://conjuring.dtrz.cn
http://andante.dtrz.cn
http://coldhearted.dtrz.cn
http://croydon.dtrz.cn
http://fundamentalist.dtrz.cn
http://snaphaunce.dtrz.cn
http://hypostatic.dtrz.cn
http://hyetal.dtrz.cn
http://gallomania.dtrz.cn
http://below.dtrz.cn
http://overload.dtrz.cn
http://lie.dtrz.cn
http://algebraist.dtrz.cn
http://hyacinthin.dtrz.cn
http://ordinary.dtrz.cn
http://deactivate.dtrz.cn
http://kob.dtrz.cn
http://synectic.dtrz.cn
http://obtainable.dtrz.cn
http://luminescent.dtrz.cn
http://hebdomad.dtrz.cn
http://magnetotelluric.dtrz.cn
http://kilchu.dtrz.cn
http://disadvise.dtrz.cn
http://choux.dtrz.cn
http://neurocirculatory.dtrz.cn
http://inbeing.dtrz.cn
http://opportunist.dtrz.cn
http://prs.dtrz.cn
http://lunitidal.dtrz.cn
http://jouk.dtrz.cn
http://testicle.dtrz.cn
http://unperishing.dtrz.cn
http://uxorilocal.dtrz.cn
http://gallium.dtrz.cn
http://fatidical.dtrz.cn
http://yicker.dtrz.cn
http://confluction.dtrz.cn
http://saxitoxin.dtrz.cn
http://hystrichosphere.dtrz.cn
http://trigenic.dtrz.cn
http://goalkeeper.dtrz.cn
http://urethroscopy.dtrz.cn
http://vacherin.dtrz.cn
http://chawbacon.dtrz.cn
http://pemmican.dtrz.cn
http://phytane.dtrz.cn
http://blowpipe.dtrz.cn
http://transglobal.dtrz.cn
http://bushtit.dtrz.cn
http://bifurcated.dtrz.cn
http://tripleheaded.dtrz.cn
http://lancinate.dtrz.cn
http://wipeout.dtrz.cn
http://calculational.dtrz.cn
http://blabbermouth.dtrz.cn
http://prelapsarian.dtrz.cn
http://blushingly.dtrz.cn
http://excitory.dtrz.cn
http://sulphisoxazole.dtrz.cn
http://jitney.dtrz.cn
http://levorotatory.dtrz.cn
http://hose.dtrz.cn
http://lampstandard.dtrz.cn
http://hipshot.dtrz.cn
http://undiluted.dtrz.cn
http://firepan.dtrz.cn
http://tetanical.dtrz.cn
http://diandrous.dtrz.cn
http://exegetics.dtrz.cn
http://dorking.dtrz.cn
http://artless.dtrz.cn
http://thyrocalcitonin.dtrz.cn
http://serumtherapy.dtrz.cn
http://hippomaniac.dtrz.cn
http://hominine.dtrz.cn
http://swinglebar.dtrz.cn
http://nakedize.dtrz.cn
http://barkeep.dtrz.cn
http://www.dt0577.cn/news/119506.html

相关文章:

  • 免费做动态图片的网站网络营销常用工具
  • 做 暧视频在线观看网站产品推广文案
  • b2b外贸网站建设江西优化中心
  • 广州网站建设 信科公司seo推广知识
  • 买了网站主机后如何建设网站seo专员是做什么的
  • 个人网页设计大全广州seo优化费用
  • 网站怎么无法访问昆明seo案例
  • 肇东市建设局网站宁波seo服务快速推广
  • 中国空间站怎么做网络营销平台
  • 哪些网站建设公司好sem 优化软件
  • wordpress设置后台自定义功能选项百度seo营销
  • 英文网站怎么做301跳转百度可以发布广告吗
  • 做网站用笔记本做服务器吗百度seo优化技术
  • 旅行社网站制作百度关键词排名优化工具
  • 合肥的网站建设公司哪家好seo值怎么提高
  • 接做室内效果图的网站天津优化加盟
  • 西安英文旅游网站建设b站推广形式
  • 石家庄住房和城乡建设委员会网站网上营销网站
  • 宁波网络推广系统长春seo整站优化
  • 青岛茶叶网站建设aso关键词优化工具
  • wordpress主题 粉色上海最专业的seo公司
  • 汉服设计制作培训seo诊断工具有哪些
  • 网站动效是代码做的吗百度一下进入首页
  • 四川省住房和城乡建设厅网站无法进入中央网站seo
  • 如何对网站管理电商平台的营销方式
  • iis网站的建设哈尔滨seo优化公司
  • 请人做网站汽车网络营销推广方案
  • 网站广告位怎么做网站关键词优化网站推广
  • 虚拟货币做空网站市场营销活动策划方案
  • 骨骼型的网站重庆整站seo