🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #13948

Re: truncating a file.

#13948
From: Stellan Klebom
Date: Wed, 28 Feb 1990 18:28
36 lines
2194 bytes
In article <591@galadriel.bt.co.uk> stevep@galadriel.bt.co.uk (Steve Paine) writes:
>Could someone give me a starting point on how to truncate an AmigaDOS file
>in 'C' please. (e.g taking, say, 20 bytes off the end.) Just copying the 
>(file - number_of_bytes_to_reduce_by) is not going to be good enough because as
>I will only be taking a maximum of 100 bytes off, and on a floppy too, I will
>have a prob with files bigger than 400 Kbytes - it wont fit on a floppy.
>(Yes, I will have a file that big, its hopefuly going to be a database!) 
>I need something along the lines of the SunOs function truncate() if thats
>any help to you. 
>
>	Any help will be greatly appreciated.
>
>	Steve Paine.
>	British Telecom Research labs,
>	Martlesham,
>	Ipswich,
>	ENGLAND.

Truncating a file under Amiga DOS is only possibel under FastFileSystem. But
there is no system call, so you have to deal with it at packet level. Under
the old filesystem, the only thing you can do is to make a copy of the file
with the part you want to truncate left out. Well, maybe ther is a way to do it
but the you have to fiddle directly with the sectors on disk.


        Stellan

-------------------------------------------------------------------------------
E-Mail: UUNET: d88-skl@nada.kth.se      * #include <std-disclaimer.h>
	UUCP:  uunet!sunic!nada!d88-skl *
                                        * You'll never now,
Snail-Mail: Stellan Klebom              * tomorrow may be cancelled!
            Axvaegen 6                  *
            S-175 44 JAERFAELLA         *
            SWEDEN                      * (Yet another intelligent statement)
-------------------------------------------------------------------------------
Technical Details
Message-ID: <3042@draken.nada.kth.se>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!kth.se!draken!d88-skl
References: <591@galadriel.bt.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!kth.se!draken!d88-skl
From: d88-skl@nada.kth.se (Stellan Klebom)
Newsgroups: comp.sys.amiga.tech
Subject: Re: truncating a file.
Message-ID: <3042@draken.nada.kth.se>
Date: 28 Feb 90 18:28:21 GMT
References: <591@galadriel.bt.co.uk>
Reply-To: d88-skl@nada.kth.se (Stellan Klebom)
Organization: Royal Institute of Technology, Stockholm, Sweden
Lines: 36