Last active
November 28, 2018 15:09
-
-
Save tripulse/9d537b8613428f2d48d10b49bcdb4a8f 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 <unistd.h> | |
#define CHUNK 4096 | |
int main() | |
{ | |
int fd; | |
char buf[CHUNK]; | |
size_t nRead; | |
fd = open("test.txt", O_READ); | |
// Reads then writes the data | |
while(nRead = read(fd, CHUNK, buf)) | |
write(1, CHUNK, buf); | |
close(fd); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
open(1), read(1), write(1)