Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!tank!nic.MR.NET!umn-d-ub!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.std.c Subject: Re: What's a good prototype for write(2)? Message-ID: <8756@smoke.BRL.MIL> Date: 26 Oct 88 09:42:30 GMT Article-I.D.: smoke.8756 References: <902@vsi.COM> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Distribution: comp Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 18 In article <902@vsi.COM> friedl@vsi.COM (Stephen J. Friedl) writes: >What is a proper prototype for write(2)? extern int write(int, const char *, unsigned); describes the existing function and should be used if you want to avoid relying on the automatic parameter conversions that prototypes provide (in order that your code continue to work on older systems). >but how does this deal with a successful >write very near the maximum unsigned value? You have to cast the result to unsigned before comparing it to the requested count. But before you do that, test for -1 (error). >P.S. - I know that write(2) is not specified in the dpANS. But it is specified by IEEE 1003.1-1988 (they don't use prototypes). My copy isn't at hand so I can't check just how it ended up.