AAE-CNAS-Labs/Topic-6/task_6_2.c

17 lines
367 B
C
Raw Normal View History

2021-04-03 20:08:15 +02:00
//
// 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;
}