Run the following C programming code and explain in detail how the program works with the topic
Fantastic news! We've Found the answer you've been seeking!
Question:
Run the following C programming code and explain in detail how the program works with the topic of I/O and UNIX I/O Programming.
*Include screenshots of program execution
#include
#include
#include
#include
#include
#include
#define FILE "76-os192-demo.txt"
void main(void) {
printf("See %s", FILE);
printf ("OUT=%d", STDOUT_FILENO);
close(STDOUT_FILENO);
int fd1 = open (FILE, O_RDWR |
O_CREAT | O_TRUNC, 0644);
int fd2 = dup2(fd1, 9);
printf( "A");
fprintf(stdout, "B");
dprintf(fd2, "fd1=%dfd2=%d",
fd1, fd2);
}
Related Book For
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord
Posted Date: