21 lines
424 B
C
21 lines
424 B
C
|
///********************/
|
||
|
///* 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;
|
||
|
}
|