open,write,read函数
来源:互联网 发布:mac 音乐升降调编辑 编辑:程序博客网 时间:2024/05/21 06:54
1、写文件write函数:
#include <stdio.h>
//文件操作函数头文件
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
ssize_t write(int fd, const void *buf, size_t count);
–参数fd表示:使用open 函数打开文件之后返回的句柄
–参数*buf表示:写入的数据
–参数count表示:最多写入字节数–返回值:出错-1,;其它数值表示实际写入的字节数
2、读文件read函数:
//标准输入输出头文件
#include <stdio.h>
//文件操作函数头文件
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define MAX_SIZE 1000
ssize_t read(int fd,void *buf,size_t len);
–参数fd:使用open 函数打开文件之后返回的句柄
–参数*buf:读出的数据保存的位置
–参数len:每次最多读len 个字节
–返回值:错误返回-1,执行成功返回实际读取值
0 0
- open,write,read函数
- open、write、read函数
- linux下 open() write() read() close函数
- open、read、write、close函数应用实例
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- linux下 open() write() read() close函数
- open、close、read、write四个函数
- mkfifo,open,write,read
- mkfifo,open,write,read
- write&read&open
- read/write/open
- open函数 write函数 以及 read函数 文件描述符
- 创建mysql数据库
- mongoDB数据库的概述与安装
- 吐槽
- 关于宏定义的计算问题
- 欧拉计划 31
- open,write,read函数
- TCP/IP的三次握手与四次挥手详解
- 如何上传本地代码到github
- 服务器常见页面访问返回错误信息的含义
- Leetcode 463 Island Perimeter
- html中 在输入框(input标签)中只能输入数字
- 借书方案
- bzoj 3924: [Zjoi2015]幻想乡战略游戏
- Android上实现一个简单的天气预报APP(十一) Preference存储最近一次查询的城市