Last active
August 29, 2015 14:07
-
-
Save CatTail/f14c438e3f476b6affc5 to your computer and use it in GitHub Desktop.
block reading
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 <stdio.h> | |
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/uio.h> | |
int main(void) | |
{ | |
char buf[80]; | |
// read | |
ssize_t size = read(fileno(stdin), buf, sizeof(buf)); | |
if (size == -1) { | |
perror("read()"); | |
exit(EXIT_FAILURE); | |
} | |
printf("%s", buf); | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment