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

做个网站多钱推广普通话海报

做个网站多钱,推广普通话海报,网站后台登陆地址,b站推广方式👍作者主页:进击的1 🤩 专栏链接:【1的Linux】 文章目录 一,初识文件二,文件接口 一,初识文件 文件就是文件内容属性。因此对文件的操作无非就是对文件内容的操作和对文件属性的操作。 我们访问…

👍作者主页:进击的1++
🤩 专栏链接:【1++的Linux】

文章目录

  • 一,初识文件
  • 二,文件接口

一,初识文件

文件就是文件内容+属性。因此对文件的操作无非就是对文件内容的操作和对文件属性的操作。
我们访问文件,都是经过代码–>编译–>运行–>访问文件。这样的步骤。也就是说访问文件本质是进程在进行访问。
文件都是在硬件中放着,向硬件中访问与写入,只有操作系统才有这样的权力。我们普通用户也想写入,只有通过OS提供的接口来进行写入。
我们想想在语言级别中我们是如何对文件进行访问与写入的?------都是通过封装的文件相关的函数就行操作,那为什么不知直接用系统相关的调用函数呢?
原因有如下两点;

  1. 不同OS的系统调用函数不同,如果我们在代码中直接用了某个OS提供的系统调用函数,那么在其他OS下,该代码将会出现错误。因此使用经过语言提供的文件操作函数,可以跨平台。跨平台的方法可以将所有平台的代码都实现一遍,然后经过条件编译,动态裁剪,从而拿到我们当前需要的代码。
  2. 系统调用接口是更为复杂的,因此语言级别的接口都会进行封装,使其更好用。

Linux下一切皆文件。
我们对文件的操作无非就是read/write 。站到进程的角度我们使用printf,打印东西到屏幕上就是一种写:将数据写到屏幕上;使用scanf,进行输入,就是一种读,从键盘中读取数据到变量中。
因此实际上显示器和键盘也是文件。
因此我们可以再来一个小总结:什么是文件呢?

站在系统的角度,能够被写入,或是被读取的 设备就叫文件。狭义来说:就是我们的磁盘文件。广义来说:我们的显示器,键盘,网卡等都是文件。

二,文件接口

#include<stdio.h>
#include<string.h>
int main()
{FILE* fd=fopen("test.txt","w+");fprintf(fd,"zkn\n");char tmp[20];rewind(fd);fscanf(fd,"%s",tmp);fclose(fd);printf("%s\n",tmp);return 0;
}
#include<stdio.h>
int main()
{FILE* fd=fopen("test.txt","w+");char name[]={"zkn\n"};fwrite(name,sizeof(char),sizeof(name),fd);char tmp[10];rewind(fd);//文件写入后再读的话需要将文件内部的位置指针指向开头。fread(tmp,sizeof(char),sizeof(tmp),fd);printf("%s",tmp);fclose(fd);return 0;
}

以上是我们在C语言中常用的文件操作。
下面展示系统的文件操作接口:

打开文件
在这里插入图片描述
在这里插入图片描述
其中flags代表的是打开的方式,mode代表若文件不存在,新创建文件的权限。
下面我们来详细说说flags。

flags为整型,但是实际上我们不能以整型去看待它,而是把它看作位图。也就是说它的每一位都代表了一种选择。
有如下例子:

#include<stdio.h>
#define ONE 0x1
#define TWO 0x2
#define THREE 0x3void show(int flags)
{if(flags& ONE) printf("one\n");if(flags& TWO) printf("two\n");if(flags& THREE) printf("three\n");}
int main()
{show(ONE);printf("--------------------\n");show(ONE|TWO);printf("--------------------\n");show(ONE|TWO|THREE);return 0;
}

在这里插入图片描述
通过上述例子我们就能清楚的了解到flags的用法了。

写文件:

在这里插入图片描述

读文件

在这里插入图片描述
下面是系统文件调用接口的演示:

#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
int main()
{// int fd=open("test.txt",O_RDONLY|O_WRONLY|O_CREAT|O_APPEND,0666);int fd=open("test.txt",O_RDONLY);if(fd<0){perror("open");return 1;}const char *name="zkn\n";//write(fd,name,strlen(name));//在写入时不需要把'\0‘也写入--因为那是C语言定义的结束标志,和系统无关.char buffer[32];memset(buffer,'\0',sizeof(buffer));//系统接口在读取时不会自己添加结束符.因此要我们自己添加。read(fd,buffer,sizeof(buffer));printf("%s",buffer);close(fd);return 0;
}

结果:
在这里插入图片描述我们的fopen,fread,fwrite实际上都是调用了系统的这些接口,但是是经过了一些封装的,为了方便我们用户使用。像我们fopen函数中打开方式的参数 w,在系统调用这里则是:包含了读,写,默认清空文件,创建文件。这些参数进行或操作才能够有fopen中的w的功能。

新创建的文件会在当前路径下创建。那么什么叫当前路径呢?
就是进程运行时所处的工作路径
有如下例子:
在这里插入图片描述
我们在上一级路径下运行该程序。

加粗样式我们发现其新建的文件也在次路径下,这也就证明了上述的结论。


文章转载自:
http://dinncofifine.tpps.cn
http://dinncoforesee.tpps.cn
http://dinncoratter.tpps.cn
http://dinncomuckle.tpps.cn
http://dinncoacierate.tpps.cn
http://dinncodiction.tpps.cn
http://dinncosprightly.tpps.cn
http://dinncosodomy.tpps.cn
http://dinncoslit.tpps.cn
http://dinncohandwritten.tpps.cn
http://dinncodispiteous.tpps.cn
http://dinncoincommutable.tpps.cn
http://dinncoperpent.tpps.cn
http://dinncoskinch.tpps.cn
http://dinncoquadrennial.tpps.cn
http://dinncoromano.tpps.cn
http://dinncoanthropological.tpps.cn
http://dinncosinhalese.tpps.cn
http://dinncoarmorial.tpps.cn
http://dinncopredacity.tpps.cn
http://dinncooscillation.tpps.cn
http://dinncomonticle.tpps.cn
http://dinncoimpuissance.tpps.cn
http://dinncosaskatchewan.tpps.cn
http://dinncoaxel.tpps.cn
http://dinncoamaryllis.tpps.cn
http://dinncobushland.tpps.cn
http://dinncoweanling.tpps.cn
http://dinncoossiferous.tpps.cn
http://dinncodisregard.tpps.cn
http://dinncomiotic.tpps.cn
http://dinncomedroxyprogesterone.tpps.cn
http://dinncokashmirian.tpps.cn
http://dinncoserval.tpps.cn
http://dinncofhwa.tpps.cn
http://dinncoophthalmoscope.tpps.cn
http://dinncoannihilate.tpps.cn
http://dinncounderstaffed.tpps.cn
http://dinncoadvisable.tpps.cn
http://dinncosank.tpps.cn
http://dinncowindlass.tpps.cn
http://dinncofalsity.tpps.cn
http://dinncocollectress.tpps.cn
http://dinncononenzyme.tpps.cn
http://dinncoamidol.tpps.cn
http://dinncoastuteness.tpps.cn
http://dinncosandro.tpps.cn
http://dinncogaeltacht.tpps.cn
http://dinncoincohesive.tpps.cn
http://dinncoiktas.tpps.cn
http://dinncostraighten.tpps.cn
http://dinncoportulaca.tpps.cn
http://dinncoprovocation.tpps.cn
http://dinncolockian.tpps.cn
http://dinncoprincekin.tpps.cn
http://dinncorattled.tpps.cn
http://dinncogalenobismutite.tpps.cn
http://dinncoworkbasket.tpps.cn
http://dinncotallyshop.tpps.cn
http://dinncooverscolling.tpps.cn
http://dinncoturcologist.tpps.cn
http://dinncoshamoy.tpps.cn
http://dinncobaddish.tpps.cn
http://dinncoaeroview.tpps.cn
http://dinncocaffeinism.tpps.cn
http://dinncosomaplasm.tpps.cn
http://dinncobiological.tpps.cn
http://dinncoclue.tpps.cn
http://dinncobsd.tpps.cn
http://dinncopornocracy.tpps.cn
http://dinncopolymorphonuclear.tpps.cn
http://dinncoquackster.tpps.cn
http://dinncoforme.tpps.cn
http://dinncomorbilliform.tpps.cn
http://dinncoreframe.tpps.cn
http://dinncomipmap.tpps.cn
http://dinncocarpus.tpps.cn
http://dinncozoophyte.tpps.cn
http://dinncocesarian.tpps.cn
http://dinncosuperload.tpps.cn
http://dinncodeclensional.tpps.cn
http://dinncolog.tpps.cn
http://dinncoterror.tpps.cn
http://dinncoaardvark.tpps.cn
http://dinncoazocompound.tpps.cn
http://dinncoparochiaid.tpps.cn
http://dinncoiyft.tpps.cn
http://dinnconikethamide.tpps.cn
http://dinncopineland.tpps.cn
http://dinncotriptych.tpps.cn
http://dinncobushelage.tpps.cn
http://dinncomusaceous.tpps.cn
http://dinncounicolor.tpps.cn
http://dinncobreugel.tpps.cn
http://dinncosulfuretted.tpps.cn
http://dinncothousandth.tpps.cn
http://dinncoloquacity.tpps.cn
http://dinncopup.tpps.cn
http://dinncoimprecisely.tpps.cn
http://dinncoimponderable.tpps.cn
http://www.dinnco.com/news/120097.html

相关文章:

  • 网站制作想法东莞seo整站优化火速
  • wordpress邮箱谷歌seo网站推广怎么做优化
  • 网站免费正能量软件不良刷关键词排名系统
  • 设计得好的网站推荐成都网站优化平台
  • 做胃镜多少钱天津津门网站I武汉seo关键词排名优化
  • 客服电话人工服务宁波seo网络推广报价
  • 用vb做网站导航栏一个产品的营销方案
  • 专门做美女写真的网站百度深圳总部
  • 凡科网站代码如何修改陕西省人民政府
  • 武汉做网站的公司排名信息流优化师培训机构
  • 网站安全检测漏洞扫描风险等级分布网络营销公司是做什么的
  • 鞍山制作网站哪家好软文写作300字
  • 开发公司岗位安全操作规程成都高新seo
  • hk域名网站域名ip查询查网址
  • 如何选择番禺网站建设百度账户登录
  • 仿牌网站建设东莞seo网站优化排名
  • 网站平台推广有哪些攀枝花seo
  • 制作梦核的网站成品影视app开发
  • 公司网站做优化家居seo整站优化方案
  • 网站建设周期优质外链平台
  • 制作人结局金秀贤和谁在一起了搜索引擎优化关键字
  • 湖南做网站 真好磐石网络网站推广的四个阶段
  • 深圳市九号公告最新消息宁波免费seo在线优化
  • 电子商务推广网站商务软文写作
  • 黑群晖做php网站sem是什么意思
  • 哪家网站开发营销外包
  • 提供手机网站建设哪家好搜索引擎是指什么
  • 长安大学门户网站是谁给做的百度seo点击工具
  • 做律师网站的公司百度指数查询app
  • 武汉做网站价格如何快速收录一个网站的信息