17 lines
367 B
C
17 lines
367 B
C
|
//
|
||
|
// Written for Computer Networks and Systems lab classes
|
||
|
// AUTHOR : Sergiusz Warga
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
int main() {
|
||
|
char msg_write[] = "write() to dup(1)\n";
|
||
|
int soutfd = dup(STDOUT_FILENO);
|
||
|
write(soutfd, msg_write, sizeof(msg_write));
|
||
|
|
||
|
FILE *fakeout = fdopen(soutfd, "w");
|
||
|
fprintf(fakeout, "using fprintf() on fakeout\n");
|
||
|
|
||
|
return 0;
|
||
|
}
|