|
<article data-content="[{"type":"block","id":"xKFL-1669118229208","name":"code","data":{"wrap":false,"version":1,"language":"","theme":"default"},"nodes":[{"type":"block","id":"8Rs1-1669118229207","name":"code-line","data":{},"nodes":[{"type":"text","id":"44Yj-1669116525802","leaves":[{"text":"头文件:","marks":[]}]}]},{"type":"block","id":"XzSy-1669118231875","name":"code-line","data":{},"nodes":[{"type":"text","id":"Giuw-1669118231874","leaves":[{"text":" #include \r","marks":[]}]}]},{"type":"block","id":"v28c-1669118230222","name":"code-line","data":{},"nodes":[{"type":"text","id":"pAaw-1669118230221","leaves":[{"text":"函数原型:","marks":[]}]}]},{"type":"block","id":"oc2O-1669118257831","name":"code-line","data":{},"nodes":[{"type":"text","id":"zFFR-1669118257830","leaves":[{"text":" ssize_t write(int fd, const void *buf, size_t nbyte);\r","marks":[]}]}]},{"type":"block","id":"125y-1669118230224","name":"code-line","data":{},"nodes":[{"type":"text","id":"tsJu-1669118230223","leaves":[{"text":"参数:","marks":[]}]}]},{"type":"block","id":"dl26-1669118269105","name":"code-line","data":{},"nodes":[{"type":"text","id":"CfQa-1669118269104","leaves":[{"text":" fd:想要写入数据的文件的描述符","marks":[]}]}]},{"type":"block","id":"fvat-1669118283971","name":"code-line","data":{},"nodes":[{"type":"text","id":"xTtS-1669118283970","leaves":[{"text":" buf:想要写入到文件中的数据","marks":[]}]}]},{"type":"block","id":"iA84-1669118292454","name":"code-line","data":{},"nodes":[{"type":"text","id":"TIWr-1669118292453","leaves":[{"text":" nbyte:想要写入的字节数","marks":[]}]}]},{"type":"block","id":"1eEw-1669118324776","name":"code-line","data":{},"nodes":[{"type":"text","id":"5cjb-1669118324775","leaves":[{"text":"返回值:","marks":[]}]}]},{"type":"block","id":"DM3E-1669118334339","name":"code-line","data":{},"nodes":[{"type":"text","id":"LKP4-1669118334337","leaves":[{"text":" 整型返回值:","marks":[]}]}]},{"type":"block","id":"9C0L-1669118351540","name":"code-line","data":{},"nodes":[{"type":"text","id":"GGRF-1669118351538","leaves":[{"text":" 成功:返回实际写入的字节数","marks":[]}]}]},{"type":"block","id":" WwP-1669118355009","name":"code-line","data":{},"nodes":[{"type":"text","id":"m5qv-1669118355008","leaves":[{"text":" 失败:返回-1","marks":[]}]}]}],"state":{}}]">什么是文件IO:对文件进行输入输出的操作文件:linux下一切皆文件I :input输入O utput输出open打开close关闭write写入read读取怎么使用这些函数:linux系统给我们提供了man手册来学习函数
头文件: #include <unistd.h> 函数原型: ssize_t write(int fd, const void *buf, size_t nbyte);参数: fd:想要写入数据的文件的描述符 buf:想要写入到文件中的数据 nbyte:想要写入的字节数返回值: 整型返回值: 成功:返回实际写入的字节数 失败:返回-1
|
|