
FILE * <-> System File Handles
Quote:
>|
>| > I've run up against a disturbing feature of the Microsoft C compiler
>| > for the PC. Microsoft limits an applicaton to 20 open files, 5 of
>| > which are taken up by the standard file handles. I can open my files
>| > using DOS system calls to bypass the compiler, ...
>|
>| This limit is imposed by MS-DOS itself, not by the C compiler.
> Unfortunately, the limit is also imposed by the C library
>which maintains its own table of open file descriptors. This table
>contains information about the binary/text mode of the file and
>whether it is open (don't know why they really need the second).
>(This is for MSC 4.0.)
> Dan Lanciani
ahhhh...I had a problem the other day the I think may have something to do
with this. The following piece of code will clarify:
#include <stdio.h>
main()
{
FILE *otherptr ;
fprintf(stdprn,"This goes to the system printer!!") ;
otherptr = strprn ;
fprintf(otherptr,"And so does this...(on the same line even)\n") ;
fclose(otherptr) ;
fprintf(stdprn,"But this doesn't....???????\n") ;
Quote:
}
BTW, this was using IBM C 1.0 (can anybody tell me roughly what MSC version
this is??). fclose seems to have a FILE * linked in some manner with the
corresponding system file handle. When you have two pointers sharing a handle
(as seems to happen in this case), fclose seems to close out both the system
handle as well as the FILE *.
Not the question is: Does this make sense? I have been able to convince my
self both ways. Anybody got a good argument!!
Michael Hunter UUCP : ....{seismo, rutgers, ames}!cit-vax!oxy!bagpiper