C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
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".
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
would it make more sense for the child to be using read() to read in from the pipe rather than fgets()
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
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.
Last edited by MK27; 03-14-2009 at 11:47 PM.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
A program that prints a negative integer in hexadecimal representation to standard output.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?Originally Posted by MK27
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge