what do I need to do or add into my code in order for this error to go away. I believe that STDOUT_FILENO is part of the C STDLIB. Thank you. The error is only showing for the first STDOUT_FILENO, not the second one that is the line below it.
#include <stdio.h>
#include <stdlib.h>
void main(int argc, char *argv[]) {
int pipefd[2];
pid_t cpid;
char buffer;
if (pipe(pipefd) == -1)
{
exit(1);
}
cpid = fork();
if (cpid == -1)
{
exit(1);
}
if (cpid == 0) {
close(pipefd[1]);
while (read(pipefd[0], &buffer, 1) > 0)
write(STDOUT_FILENO, &buffer, 1);
write(STDOUT_FILENO, "\n", 1);
close(pipefd[0]);
exit(EXIT_SUCCESS);
}
else {
close(pipefd[0]);
write(pipefd[1], argv[1], strlen(argv[1]));
close(pipefd[1]);
wait(NULL);
exit(EXIT_SUCCESS);
}
}