Created
December 13, 2017 17:45
-
-
Save tarcisio-marinho/0997783155a33549d54f795438f27cd7 to your computer and use it in GitHub Desktop.
get rid of a file
This file contains hidden or 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
void *buf = malloc(BUF_SIZE); // allocate memory | |
memset(buf, 0, BUF_SIZE); // zero the memory | |
ssize_t ret = 0; | |
off_t shift = 0; | |
while((ret = write(fd, buf, | |
((fsize - shift >BUF_SIZE)? | |
BUF_SIZE:(fsize - shift)))) > 0) | |
shift += ret; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment