Created
March 31, 2017 18:15
-
-
Save morsoinferno/7029d11a03cabba31c6b152d51d7d5db to your computer and use it in GitHub Desktop.
05_dup1
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 <stdlib.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
void main() | |
{ | |
int fd; | |
fd = dup2(1, 200); | |
close(STDOUT_FILENO); | |
//fd = dup(STDOUT_FILENO); | |
//duplico STDOUT en 200 | |
//dup2(old_fd, new_fd) | |
//fd = dup2(1, 200); | |
//close(STDOUT_FILENO); | |
write(fd, "Mi mensaje\n", 12); | |
printf("fd = %d\n", fd); // se muestra por pantalla? | |
exit(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment