🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5422

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

#5422
From: Doug Gwyn
Date: Sat, 29 Oct 1988 21:45
13 lines
1289 bytes
In article <2991@ttrdc.UUCP> levy@ttrdc.UUCP (Daniel R. Levy) writes:
-not taking into account the possibility of a "short write" which is yet
-not the result of an error condition.  I was burned like this when porting
-a game program which originally ran on System V, which to do a save writes
-off its entire data segment in one big write(), to the Eunice emulation of
-BSD under VMS.  write() would only work in 65k chunks, as I recall, and
-I had to use a loop.

Yes, you should always loop on successful writes until all the data is
transferred, unless it is known that exact record size is important (as
on a magtape duplicator).

I think I'll post my 9th Ed. UNIX-compatible "cat" source as an example.
Technical Details
Message-ID: <8799@smoke.BRL.MIL>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!mcdchg!chinet!att!osu-cis!tut.cis.ohio-state.edu!ukma!gatech!rutgers!cmcl2!adm!smoke!gwyn
References: <902@vsi.COM> <6794@pasteur.Berkeley.EDU> <21763@watmath.waterloo.edu> <8777@smoke.BRL.MIL> <2991@ttrdc.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!mcdchg!chinet!att!osu-cis!tut.cis.ohio-state.edu!ukma!gatech!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: <8799@smoke.BRL.MIL>
Date: 29 Oct 88 21:45:01 GMT
References: <902@vsi.COM> <6794@pasteur.Berkeley.EDU> <21763@watmath.waterloo.edu> <8777@smoke.BRL.MIL> <2991@ttrdc.UUCP>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>)
Distribution: comp
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 13