Xref: utzoo comp.lang.c:10745 comp.lang.c++:1248 Path: utzoo!attcan!uunet!lll-winken!lll-lcc!ames!umd5!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: I/O implementation in C and C++ Summary: doing your own thing Keywords: C++, I/O, buffer allocation Message-ID: <316@proxftl.UUCP> Date: 14 Jun 88 17:51:16 GMT References: <462@polari.UUCP> Organization: Proximity Technology, Ft. Lauderdale Lines: 16 In article <462@polari.UUCP>, rlb@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.