ftruncate for System Vr3.2

John R. Levine johnl at esegue.segue.boston.ma.us
Thu Sep 6 14:47:52 AEST 1990


In article <1990Sep5.222350.6918 at clark.eduyou write:
>System V does not have ftruncate.

But Xenix had the equivalent chsize(), so on Sys V/386 and its many
descendants you can use it.

The call:

	chsize(f, n);

changes the size of the file open on descriptor f to be n.  You can make a
file larger or smaller, a zero n truncates the file.  The file has to be
open for writing.  Chsize lives in the xenix library libx.a, so you need a
-lx flag on your compile line.

Note that this scores near zero in the portability department; I don't
know what SVR4 does but would expect it to have the BSD ftruncate.

Regards,
John Levine, johnl at esegue.segue.boston.ma.us, {spdcc|ima|world}!esegue!johnl



More information about the Comp.unix.sysv386 mailing list