Re: Printing files every step



CBFalconer <cbfalconer@xxxxxxxxx> writes:
Keith Thompson wrote:
Roberto Waltman <usenet@xxxxxxxxxxxx> writes:

... snip ...

You may not be able to open 100 files in a single program, even if
your code is 100% correct from the coding and logic points of view.
And if you can open 100 files, that means 100 less are available to
the system as a whole, potentially causing other programs to fail.

Does *every* system impose this kind of limit? I know that many do,
but it's easy to imagine a system where the number of simultaneously
open files is limited only by the amount of memory necessary to
describe them. Such a system would have no fixed-size tables of file
descriptors, for example.

No. Try CP/M for example, and FCBs. The space is in the users
area, and limited only by what he can get. The disadvantage is
that the user has to close files properly.

Does "the user has to close files properly" imply that if I fail to
close a file, it will continue to consume system resources after my
program terminates?

Note that the standard says that exit() closes all open streams (and
returning from main() is equivalent to calling exit(), so a C program
under a conforming implementation shouldn't have this problem.

Of course closing files you opened is a good idea anyway.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages

  • Re: Surrogate Factoring Solution
    ... > find myself holding on to it, versus just junking ideas that fail. ... > time to do the chunking. ... No one is trying to control your behavior. ...
    (sci.math)
  • Re: Surrogate Factoring Solution
    ... > find myself holding on to it, versus just junking ideas that fail. ... > time to do the chunking. ... No one is trying to control your behavior. ...
    (sci.crypt)
  • Re: Pointers
    ... An exit status of one is not portable. ... EXIT_SUCCESS for normal termination and EXIT_FAILURE for abnormal ones. ... which will call abort() if I was wrong, so that I can check what ...
    (comp.lang.c)
  • Re: catching exit
    ... The code is covered with 'exit' calls. ... language, whose name is that of our local favorite language with a ... And rewriting the now-library to ...
    (comp.lang.c)
  • Re: I need help please!
    ... acknowledge it COULD fail, possibly, maybe, and possibly maybe ... death at the keyboard with your cheek hitting CTRL and your nose ... So people who point out your mistakes are trolls. ...
    (comp.lang.c)