What's a good prototype for write(2)?

Ray Butterworth rbutterworth at watmath.waterloo.edu
Thu Oct 27 03:12:29 AEST 1988


In article <6794 at pasteur.Berkeley.EDU>, faustus at 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 at vsi.COM>, friedl at 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.



More information about the Comp.std.c mailing list