题目:在C程序中系统调用linux的文件操作函数open,read,write,close实现将3行hello打印到指定文件中。
程序如下:
#include <sys/types.h>#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFER_SIZE 100
int read_line(int fd, char *buf, int count);
int main()
{
int to_fd;
int length;
int bytes_write,bytes_read;
char buffer[BUFFER_SIZE] = "hello";
char show[BUFFER_SIZE];
char *ptr;