Created
July 1, 2015 13:55
-
-
Save zaccone/d227e697cd25dd979978 to your computer and use it in GitHub Desktop.
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 <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#define BUF_SIZE 128 | |
int main() { | |
char *path= "/tmp/file"; | |
char *buf[BUF_SIZE]; | |
int fd = open(path, O_RDONLY); | |
int size = 0; | |
while((size = read(fd, buf, BUF_SIZE)) != 0) { | |
write(1, buf, size); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment