Created
September 25, 2011 16:27
-
-
Save uhziel/1240801 to your computer and use it in GitHub Desktop.
apue.2e.fig1.4.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "apue.h" | |
#define BUFFSIZE 4096 | |
int main() | |
{ | |
int n; | |
char buf[BUFFSIZE]; | |
while ((n = read(STDIN_FILENO, buf, BUFFSIZE)) > 0) | |
{ | |
if (write(STDOUT_FILENO, buf, n) != n) | |
{ | |
err_sys("write error"); | |
} | |
} | |
if (n < 0 ) | |
{ | |
err_sys("read error"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment