🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #42047

Re: truncate() for MS-DOS

#42047
From: Tom Almy
Date: Fri, 09 Feb 1990 16:44
20 lines
1414 bytes
In article <5280@convex.convex.com> graham@convex.com (Marv Graham) writes:
>Neither Borland's TC 2.0 nor Zortech's ZTC 2.06 have a function
>which acts like the UN*X truncate() function.  Is equivalent
>functionality available?  Where?

I don't know off the top of my head how to do it in these languages, but
I do know the MSDOS calls necessary to do the job.  First you position
the file to where you want eof, and then you write zero bytes to the file.
You'll never get this to work from within C via the stdio functions fseek()
and fwrite()*, but there is a chance that lseek() and write() will do the job,
assuming they pass the calls direct to dos without trying to do funny stuff
(I could imagine an implementation of write() which specifically checks for
a zero length write and does nothing so as to match UNIX functionality).

Tom Almy
toma@tekgvs.labs.tek.com
Standard Disclaimers Apply


* Because of buffering
Technical Details
Message-ID: <6828@tekgvs.LABS.TEK.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tekcrl!tekgvs!toma
References: <5280@convex.convex.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!zephyr.ens.tek.com!tekcrl!tekgvs!toma
From: toma@tekgvs.LABS.TEK.COM (Tom Almy)
Newsgroups: comp.sys.ibm.pc
Subject: Re: truncate() for MS-DOS
Keywords: truncate UNIX Borland Zortech
Message-ID: <6828@tekgvs.LABS.TEK.COM>
Date: 9 Feb 90 16:44:03 GMT
References: <5280@convex.convex.com>
Reply-To: toma@tekgvs.LABS.TEK.COM (Tom Almy)
Organization: Tektronix, Inc., Beaverton,  OR.
Lines: 20