CBFalconer <> writes:
> Keith Thompson wrote:
>> Roberto Waltman <> 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- <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.