If I fopen
a file, what\'s the difference between calling fclose
or close
and which one should I use?
If forked children have
As for your second question, forked children have the same numeric file descriptor as the parent, but it's a copy; they can close it, and it will still be open for the parent and other children. (Though personally, I don't like to have files open when I fork()
... I like to make that sort of shared resource usage explicit. Pipes, of course, are an exception.)