Looks good to me.
Printable View
That is originally what I wanted to do. In my parent I
close(commpipe[1]);
when I am done writing into the pipe. Is that EOF sent through the pipe just before it is closed?
If that is the case, my child is not seeing the EOF. It continues to sit there and wait for input till I shove an EOF through the pipe myself using printf().
Well, I can't explain that. Closing the write end of the pipe should cause the read end to receive an EOF. I haven't really looked at your code though.
Also, EOF doesn't get sent through the pipe. It's not a character. The OS just causes the next read() on the pipe to return 0, which means "EOF".
would it make more sense for the child to be using read() to read in from the pipe rather than fgets()
Hmmm, I wonder what this is?
My imagination?Code:#include <stdio.h>
int main() {
printf("%x\n",EOF);
return 0;
}
Again: I don't use fgets, I was going by what the OP claimed. And NO ONE has actually contributed a working piece of code to demonstrate the OP wrong, so s/he is probably right.
A program that prints a negative integer in hexadecimal representation to standard output.Quote:
Originally Posted by MK27
At this point I would like to ask BMathis: what is your current code and what is the corresponding input, expected output and actual output?Quote:
Originally Posted by MK27