Skip to content

Instantly share code, notes, and snippets.

@cho0h5
Created November 23, 2021 10:44
Show Gist options
  • Save cho0h5/624322eb27297a9b013b6605107fe02b to your computer and use it in GitHub Desktop.
Save cho0h5/624322eb27297a9b013b6605107fe02b to your computer and use it in GitHub Desktop.
#include <unistd.h>
#include <stdio.h>
int main() {
write(0, "write 0\n", 8);
write(1, "write 1\n", 8);
write(2, "write 2\n", 8);
fprintf(stdin, "fprintf stdin\n");
fprintf(stdout, "fprintf stdout\n");
fprintf(stderr, "fprintf stderr\n");
printf("stdin fd: %d\nstdout fd: %d\nstderr fd: %d\n",
stdin->_fileno,
stdout->_fileno,
stderr->_fileno);
return 0;
}
// write 0 <- ???
// write 1
// write 2
// fprintf stdout
// fprintf stderr
// stdin fd: 0
// stdout fd: 1
// stderr fd: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment