How do I SHORTEN a file without rewriting it?

Alex Matulich alex at bilver.UUCP
Fri Oct 26 11:15:51 AEST 1990


In article <179 at ptcburp.ptcbu.oz.au> michi at ptcburp.ptcbu.oz.au (Michael Henning) writes:
>>Is there a way to shorten a file, that is, chop some data off the end of
>
>Ftruncate() (BSD call) will do the job. Under AIX (maybe others), there
>is an fclear() call that allows you to punch holes into a file at arbitrary
>places. The blocks corresponding the hole(s) are returned to the file system.
>In SysV.4, you can use fntl() to do the same.

All very fine suggestions, provided I am running unix or a derivative of
unix.  A couple ANSI C-compilers I have looked at for MS-DOS do not have
these functions.

I was hoping there was a portable ANSI-ish way to accomplish this, but
it's beginning to look like that's not the case.

Thanks to all those who replied to my question!

-- 
 _ |__  Alex Matulich   (alex at bilver.UUCP)
 /(+__>  Unicorn Research Corp, 4621 N Landmark Dr, Orlando, FL 32817
//| \     UUCP:  ...uunet!tarpit!bilver!alex
///__)     bitnet:  IN%"bilver!alex at uunet.uu.net"



More information about the Comp.lang.c mailing list