#找不到文件

Python3OS文件/方法

Python3OS文件/方法 os模块提供了非常丰富的方法用来处理文件和目录。方法描述os.access(path,mode)检验权限模式os.chdir(path)改变当前工作目录os.chflags(path,flags)设置路径的标记为数字标记os.chmod(path,mode)更改权限os.chow...
代码星球 代码星球·2020-04-09

文件锁

借助fcntl函数来实现锁机制。操作文件的进程没有获得锁时,可以打开,但无法执行read、write操作。fcntl函数:  获取、设置文件访问控制属性。      intfcntl(intfd,intcmd,.../*arg*/);&nb...
代码星球 代码星球·2020-04-09

C/C++头文件

C/C++头文件一览C、传统C++#include<assert.h>//设定插入点#include<ctype.h>//字符处理#include<errno.h>//定义错误码#include<float.h>//浮点数处理#include<fstream.h&g...
代码星球 代码星球·2020-04-09

文件和流

iostream标准库提供了cin和cout方法用于标准输入读取流和向标准输出写入流。从文件读取流和向文件写入流,需要用到fstream库。它定了三个数据类型数据类型描述ofstream该数据类型表示输出文件流,用于创建文件并向文件写入信息ifstream该数据类型表示输入文件流,用于从文件读取信息fstream该数据...
代码星球 代码星球·2020-04-09

Linux之文件通信

/**后执行,尝试读取另外一个进程写入文件的内容*/#include<stdio.h>#include<unistd.h>#include<stdlib.h>#include<fcntl.h>#include<string.h>intmain(void){ch...
代码星球 代码星球·2020-04-09

Linux进程通信之文件

父子进程共享打开的文件描述符------使用文件完成进程间通信./***fork_share_fd.c***/#include<stdio.h>#include<unistd.h>#include<string.h>#include<stdlib.h>#include&l...
代码星球 代码星球·2020-04-09

文件结构体成员排序

/***fwriteStruct.c***/#include<stdio.h>#include<string.h>structstudent{charname[10];intage;};intmain(){structstudentst[5]={0};inti;for(i=0;i<5;i+...
代码星球 代码星球·2020-04-08

文件操作(结构体写入失败)

/***write.c***/#include<stdio.h>#include<string.h>structstudent{charname[10];intage;};intmain(){structstudentst[10]={0};inti;for(i=0;i<10;i++){pr...

文件操作(排序)

文本文件,每行代表一个整数,范围在0~512之间;要求:对文件排序,不使用堆空间,只使用栈空间。 用srand()和rand()函数生成一定量的随机数/***file.c***/#include<stdio.h>#include<string.h>#include<time.h&...
代码星球 代码星球·2020-04-08

文件操作(结构体)

将结构体内容写入到文件中#include<stdio.h>#include<string.h>structstudent{charname[100];intage;};intmain(){structstudentst={"wangqinghe",30};FILE*p=fopen("./c.tx...
代码星球 代码星球·2020-04-08

文件操作(stat函数)

stat函数可以获取文件信息/***stat.c***/#include<stdio.h>#include<string.h>#include<sys/stat.h>#include<stdlib.h>intmain(){structstatst={0};//定义一个结构...
代码星球 代码星球·2020-04-08

文件操作(stat)

/***stat.c***/#include<stdio.h>#include<string.h>#include<sys/stat.h>#include<stdlib.h>intmain(){structstatst={0};//定义一个结构体,名字叫ststat("....
代码星球 代码星球·2020-04-08

文件操作(二进制文件加密解密)

加密#include<stdio.h>#include<string.h>voidcode(char*p,size_tn){size_ti;for(i=0;i<n;i++){p[i]+=3;}}intmain(){FILE*p1=fopen("./a.txt","r");FILE*p2=f...

文件操作(二进制拷贝)

#include<stdio.h>#include<string.h>#include<stdlib.h>//typedefunsignedintsize_t;intmain(){FILE*p=fopen("./a.txt","r");FILE*p1=fopen("./b.txt",...

文件操作(二进制读写)

/***a.txt***/thisisawordhelloworld/***file.c***/#include<stdio.h>#include<stdlib.h>#include<string.h>intmain(){FILE*p=fopen("./a.txt","r");whi...
首页上一页...291292293294295...下一页尾页