??文章目录
1. 案例:写文件并把写入内容打屏
我们可以通过上一节所讲的read()和write()函数来实现向一个文件中写入内容并把写入内容打印到屏幕的功能。
/************************************************************
>File Name : readandprint.c
>Author : QQ
>Company : QQ
>Create Time: 2022年05月13日 星期五 12时11分44秒
************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define BUF_MAX 512 /*buf缓冲区最大值*/
/*向中文件写入