Path: utzoo!utgpu!water!watmath!rbutterworth From: rbutterworth@watmath.waterloo.edu (Ray Butterworth) Newsgroups: comp.std.c Subject: Re: What's a good prototype for write(2)? Message-ID: <21763@watmath.waterloo.edu> Date: 26 Oct 88 17:12:29 GMT References: <902@vsi.COM> <6794@pasteur.Berkeley.EDU> Distribution: comp Organization: U of Waterloo, Ontario Lines: 19 In article <6794@pasteur.Berkeley.EDU>, faustus@ic.Berkeley.EDU (Wayne A. Christopher) writes: > If you have a program that has a good reason for wanting to write 2 billion > bytes at a time, please tell me what it is... 16-bit ints can only hold about 32K. > In article <902@vsi.COM>, friedl@vsi.COM (Stephen J. Friedl) writes: > > extern int write(int, const void *, unsigned); > > ... how does this deal with a successful > > write very near the maximum unsigned value? The return > > would then appear to be negative. How about: extern ptrdiff_t write(int, const void *, size_t); since the last parameter has to be as big as the buffer (which you can take sizeof), and the return value has to be at least that big and also allow a negative value.