Skip to content

Instantly share code, notes, and snippets.

@tripulse
Last active November 28, 2018 15:09
Show Gist options
  • Save tripulse/9d537b8613428f2d48d10b49bcdb4a8f to your computer and use it in GitHub Desktop.
Save tripulse/9d537b8613428f2d48d10b49bcdb4a8f to your computer and use it in GitHub Desktop.
#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);
}
@tripulse
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment