APUE Learning Example Source Code
Guo Wenxue
2018-10-24 8f90e48da309c9e62b828c299dd813edfc817f96
Update APUE ch1_fileIO source code, fix loss head file result to compile warinning on RPI bug
4 files modified
8 ■■■■ changed files
ch1_fileIO/dir.c 2 ●●●●● patch | view | raw | blame | history
ch1_fileIO/file_io.c 1 ●●●● patch | view | raw | blame | history
ch1_fileIO/redirect_stdio.c 4 ●●● patch | view | raw | blame | history
ch1_fileIO/syserr.c 1 ●●●● patch | view | raw | blame | history
ch1_fileIO/dir.c
@@ -1,9 +1,11 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#define TEST_DIR "dir"
ch1_fileIO/file_io.c
@@ -1,6 +1,7 @@
#include <stdio.h>   
#include <errno.h>
#include <string.h> 
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
ch1_fileIO/redirect_stdio.c
@@ -14,7 +14,7 @@
    if(fd < 0)
    {
        printf("Open file failure: %s\n", strerror(errno));
        return ;
        return 1;
    } 
    
    dup2(fd, STDIN_FILENO);
@@ -24,5 +24,7 @@
    printf("fd=%d\n", fd); 
    
    close(fd);
    return 0;
}
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>