Created
November 30, 2017 20:28
-
-
Save laanwj/8125d4971728dcfe85f6f5bd09dd572f to your computer and use it in GitHub Desktop.
Check fd assignment
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 <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
int main() | |
{ | |
close(STDIN_FILENO); | |
int fd = open("/dev/null", O_RDWR); | |
printf("%d\n", fd); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment