UNIX-programming-io

Voctl
1 min read

You can do something like that in some shell - 'ls list.txt' and the output of ls command will be in that list.txt file.

Unbuffered I/O is provided by the functions open, read, write, lseek, and close. These functions all work with file descriptors.

#include <apue.h>
#include <stdlib.h>

int main(void){
    int c;

    while((getc(stdin)) != EOF)
        if (putc(c, stdout) == EOF)
            err_sys("read error");

    if (ferror(stdin))
        err_sys("input error");

    exit(0);
}

0

Responses (0)

Sign in to leave a response.

No responses yet. Be the first.