2020-05-01 23:58:52 +02:00

21 lines
424 B
C
Executable File

///********************/
///* demo_dup2 : ... */
///********************/
# include <stdio.h>
# include <fcntl.h>
# include <unistd.h>
# define ENTREE_STANDARD 0
int main()
{ int descr_group;
char c;
descr_group = open ("/etc/passwd", O_RDONLY);
dup2 (descr_group, ENTREE_STANDARD);/// retour a tester ...
c = getchar();
while (c != EOF)
{
putchar(c); c = getchar();
}
return 0;
}