From 14bbb45d375b611d19494874996e94aad64cf912 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Mon, 06 Nov 2023 17:15:05 +0800 Subject: [PATCH] add socket argments sample --- ch1_fileIO/syserr.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ch1_fileIO/syserr.c b/ch1_fileIO/syserr.c index 75a34ac..df8ed1f 100644 --- a/ch1_fileIO/syserr.c +++ b/ch1_fileIO/syserr.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <errno.h> +#include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> @@ -10,12 +11,12 @@ { char *file_name = "/test.txt"; int fd=-1; - + fd=open(file_name, O_RDONLY, 066); if( fd < 0 ) { - perror("Open file failure"); - printf("Open file %s failure: %s\n", file_name, strerror(errno)); + perror("Open file failure"); + printf("Open file %s failure: %s\n", file_name, strerror(errno)); return 0; } -- Gitblit v1.9.1