Skip to content

Instantly share code, notes, and snippets.

@laanwj
Created November 30, 2017 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laanwj/8125d4971728dcfe85f6f5bd09dd572f to your computer and use it in GitHub Desktop.
Save laanwj/8125d4971728dcfe85f6f5bd09dd572f to your computer and use it in GitHub Desktop.
Check fd assignment
#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