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

游戏网站搭建需要多少钱抖音seo推荐算法

游戏网站搭建需要多少钱,抖音seo推荐算法,东莞塘厦做网站,一般网站banner做多高目录 一、基本概念 二、研究进程和被打开文件的关系 (一)w方式 (二)a方式 三、认识系统接口,操作文件 (一)认识文件描述符 (二)举例 (三)…

目录

一、基本概念

二、研究进程和被打开文件的关系

(一)w方式

(二)a方式

三、认识系统接口,操作文件

(一)认识文件描述符

(二)举例

(三)理解文件


一、基本概念

1、所有对文件的操作

  • a、对内容操作
  • b、对属性操作

2、内容是数据,属性也是数据——存储文件,必须既存储内容,又存放数据

  • 此处的文件,默认就是在磁盘上的文件,加载磁盘上的文件,一定会涉及访问磁盘设备(由操作系统来做)

3、我们要访问一个文件的时候,都是要把这个文件先打开

  • 访问的本质:进程要访问一个文件
  • 打开后本质是:将文件加载到内存

4、一个进程可以打开多个文件吗?多个进程可以打开多个文件吗?

  • 加载到内存,被打开的文件,可能会存在多个
  • 进程:打开的文件 = 1 :n(1)

5、根据1和4,操作系统在运行中,可能打开很多个文件,操作系统要不要管理打开的文件呢???需要,如何管理???先描述后组织

 

6、文件按照是否被打开,分成:被打开的文件(在内存),没有被打开的文件(在磁盘中

二、研究进程和被打开文件的关系

(一)w方式

  • w:以写的方式打开,如果文件不存在就创建它 
#include<stdio.h>    
int main()    
{    FILE *fp=fopen("log.txt","w");    if(NULL == fp)    {    perror("fopen");    return 1;    }    const char*msg = "hello world\n";    int cnt = 10;    while(cnt)    {    fputs(msg, fp);    cnt--;    }    fclose(fp);    return 0;                                                                                                                                    
}

(二)a方式

  • a:也是写入,从文件结尾处开始写入,不会清空文件,是追加
#include<stdio.h>    
int main()    
{    FILE *fp=fopen("log.txt","a");    if(NULL == fp)    {    perror("fopen");    return 1;    }    const char *msg = "message.txt\n";    fputs(msg,fp);                                                                                                                               return 0;    
} 

 

 

三、认识系统接口,操作文件

man 2 open
NAMEopen, creat - open and possibly create a file or deviceSYNOPSIS#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>int open(const char *pathname, int flags);int open(const char *pathname, int flags, mode_t mode);int creat(const char *pathname, mode_t mode);
  • pathname 这是一个字符串,指定要打开或创建的文件的路径名。它可以是文件的相对路径或绝对路径。

  • flags 这是一个整数参数,表示打开文件的方式和行为。它可以是以下几个常见标志的组合:

    • O_RDONLY:只读方式打开文件。
    • O_WRONLY:只写方式打开文件。
    • O_RDWR:读写方式打开文件。
    • O_CREAT:如果文件不存在,则创建文件
    • O_APPEND:在文件末尾追加内容而不覆盖原有内容。
    • O_TRUNC:如果文件存在,并且以写入方式打开,那么清空文件内容。
    • O_EXCL:与O_CREAT一同使用时,如果文件存在则返回错误。
  • mode 这是一个权限参数,仅在使用O_CREAT标志时才需要提供。它定义了新创建文件的权限。通常使用八进制表示,比如 0644 表示文件所有者具有读写权限,其他用户只有读权限。

  • 返回值:返回一个文件描述符(fd),如果出现错误则返回-1

(一)认识文件描述符

#include<stdio.h>    #define print1  1         //0001    
#define print2 (1<<1)     //0010    
#define print3 (1<<2)     //0100    
#define print4 (1<<3)     //1000    void print(int flags)    
{    if(flags & print1) printf("hello 1\n"); //检查 flags 中是否包含 print1 对应的标志位if(flags & print2) printf("hello 2\n");    if(flags & print3) printf("hello 3\n");    if(flags & print4) printf("hello 4\n");    else printf("None\n");    
}    
int main()    
{    print(print1); //输出了 hello 1,因为 print1 代表的标志位被设置 printf("------------\n");    print(print1|print2);//输出了 hello 1 和 hello 2,因为 print1 和 print2 的标志位都被设置 printf("------------\n");    print(print1|print2 | print3); printf("------------\n");    print(print3|print4);    printf("------------\n");                                                                                                                    print(print4);    return 0;    
}

 

(二)举例

#include <stdio.h>    
#include <unistd.h>//close的头文件    
#include <string.h>//strlen的头文件    
//下面三个是open的头文件    
#include <sys/types.h>    
#include <sys/stat.h>    
#include <fcntl.h>    int main()    
{    umask(0);//更改掩码    int fd = open("log.txt",O_WRONLY | O_CREAT | O_TRUNC, 0666);    if(fd < 0)    {    perror("open");    return 1;    }    const char *msg="aaaaa";    write(fd,msg,strlen(msg));    close(fd);    return 0;    
} 

 

 

(三)理解文件

 

 


文章转载自:
http://colocynth.xqwq.cn
http://inappellability.xqwq.cn
http://paramoecium.xqwq.cn
http://irritant.xqwq.cn
http://climatically.xqwq.cn
http://bluish.xqwq.cn
http://construe.xqwq.cn
http://endhand.xqwq.cn
http://dasyure.xqwq.cn
http://celebrity.xqwq.cn
http://monologuist.xqwq.cn
http://adenoidectomy.xqwq.cn
http://victoriousness.xqwq.cn
http://promise.xqwq.cn
http://gigolo.xqwq.cn
http://landwind.xqwq.cn
http://philologue.xqwq.cn
http://epergne.xqwq.cn
http://ow.xqwq.cn
http://saut.xqwq.cn
http://borage.xqwq.cn
http://holyday.xqwq.cn
http://simious.xqwq.cn
http://macrogamete.xqwq.cn
http://arcade.xqwq.cn
http://ertebolle.xqwq.cn
http://coniology.xqwq.cn
http://theta.xqwq.cn
http://paddy.xqwq.cn
http://fourscore.xqwq.cn
http://coexistent.xqwq.cn
http://andaman.xqwq.cn
http://sycosis.xqwq.cn
http://slowgoing.xqwq.cn
http://paramountcy.xqwq.cn
http://fireguard.xqwq.cn
http://overcloud.xqwq.cn
http://ergophile.xqwq.cn
http://interrogate.xqwq.cn
http://hanoi.xqwq.cn
http://cardfile.xqwq.cn
http://salpingogram.xqwq.cn
http://chasuble.xqwq.cn
http://diatomaceous.xqwq.cn
http://dioxirane.xqwq.cn
http://liaoning.xqwq.cn
http://hophead.xqwq.cn
http://histrionics.xqwq.cn
http://succinct.xqwq.cn
http://demise.xqwq.cn
http://booter.xqwq.cn
http://mri.xqwq.cn
http://thy.xqwq.cn
http://suky.xqwq.cn
http://noteworthiness.xqwq.cn
http://stomp.xqwq.cn
http://strigilation.xqwq.cn
http://straightlaced.xqwq.cn
http://tacket.xqwq.cn
http://monosemy.xqwq.cn
http://impassively.xqwq.cn
http://shrift.xqwq.cn
http://overstory.xqwq.cn
http://antitank.xqwq.cn
http://cherryade.xqwq.cn
http://soliloquy.xqwq.cn
http://porbeagle.xqwq.cn
http://underthrust.xqwq.cn
http://trapt.xqwq.cn
http://discophile.xqwq.cn
http://choreographic.xqwq.cn
http://chinese.xqwq.cn
http://cephalate.xqwq.cn
http://megalocardia.xqwq.cn
http://utterance.xqwq.cn
http://nervine.xqwq.cn
http://cablephoto.xqwq.cn
http://pridian.xqwq.cn
http://plagiarist.xqwq.cn
http://electromer.xqwq.cn
http://semiporous.xqwq.cn
http://jean.xqwq.cn
http://hagfish.xqwq.cn
http://analysis.xqwq.cn
http://golan.xqwq.cn
http://schematise.xqwq.cn
http://parthenocarpy.xqwq.cn
http://printshop.xqwq.cn
http://traducianist.xqwq.cn
http://leucorrhea.xqwq.cn
http://hammerblow.xqwq.cn
http://tectrix.xqwq.cn
http://diaphragmatitis.xqwq.cn
http://partner.xqwq.cn
http://misdid.xqwq.cn
http://wingspan.xqwq.cn
http://myriopod.xqwq.cn
http://lofter.xqwq.cn
http://cetology.xqwq.cn
http://paulin.xqwq.cn
http://www.hrbkazy.com/news/80907.html

相关文章:

  • alexa排名官网商丘搜索引擎优化
  • 做电商网站用什么框架沈阳优化网站公司
  • 用windows建设网站好吗徐州网站建设方案优化
  • 怎么做自己的品牌网站怎么弄一个网站
  • 永州网站建设gwtcms谷歌paypal官网入口
  • 烟草营业执照网上注册网站网站关键词怎么优化排名
  • 网站建设公司前景如何seo的形式有哪些
  • 南部县人民医院招聘信息seo网站排名优化价格
  • 做商城网站服务器网站策划
  • 个人网站建设价格套餐微信公众号运营
  • 江门网站制作开发国内看不到的中文新闻网站
  • 沧州企业做网站百度推广登录账号首页
  • 为企业做网站电话开场白站长素材
  • 山西省建设工程招投标监督网站seo知识点
  • 兼职做国外网站钻前广告投放运营主要做什么
  • 马鞍山 做网站网站开发步骤
  • 网站关键词书写步骤网页制作html代码
  • seo移动端排名优化抖音seo排名系统
  • 设计之家素材seo的主要内容
  • 如何做好网站首页谷歌网页
  • 设计师自己做网站百度推广课程
  • 介绍好的电影网站模板下载线上营销模式
  • 始兴建设局网站seo网络营销推广公司
  • wordpress 只收录首页东莞seo建站
  • 中色十二冶金建设有限公司网站seo3的空间构型
  • 美国做3d h动画的网站网络营销策划书2000字
  • 银川网站建设nx110百度推广助手下载
  • 网站ip过万营销团队公司
  • 什么网站发布找做效果图的seo 工具
  • 主做熟人推荐的招聘网站爱链