实验二 文件I/O实验
1.目的
2.实验内容
3.程序流程
4.命令行参数
5.命令行参数获取
6.命令行参数获取实例
7.打开文件
8.读取文件
9.写文件
10.关闭文件
11.文件多位
12.错误处理
13.拓展内容
实验
代码
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#define BUF_SIZE 1024
#define PATH_LEN 128
void my_err(char *err_string, int line )
{
fprintf(stderr,"line:%d ",line);
perror(err_string);
exit(1