I/O implementation in C and C++
T. William Wells
bill at proxftl.UUCP
Wed Jun 15 03:51:16 AEST 1988
In article <462 at polari.UUCP>, rlb at polari.UUCP (rlb) writes:
> I find it interesting that both K&R (C) and Stroustrup (C++) give
> I/O package implementation examples in which buffer allocation takes
> place at the first I/O, rather than in the "open". ...
> Are there other advantages?
> -Ron Burk
Yes. you get better control over buffer usage. For example,
once opened, you can assign your own buffer to the file. This
would be more complicated if you had to assign your own buffer
after the package had already assigned one.
> [A comment on allocation failure during I/O.]
The packages I am familiar with do not fail if the allocation
fails; instead, they just do unbuffered I/O instead of buffered
I/O.
More information about the Comp.lang.c
mailing list