ade@clark.edu (Adrian Miranda) (09/06/90)
System V does not have ftruncate. However, I believe someone once posted a replacement that was supposed to work on System V release 3.2. If you have a copy of this saved, could you be so kind as to mail it to me? Thanks in advance. Adrian Miranda uunet!clark!ade or ade@clark.edu
johnl@esegue.segue.boston.ma.us (John R. Levine) (09/06/90)
In article <1990Sep5.222350.6918@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@esegue.segue.boston.ma.us, {spdcc|ima|world}!esegue!johnl
cpcahil@virtech.uucp (Conor P. Cahill) (09/06/90)
In article <1990Sep5.222350.6918@clark.edu> ade@clark.edu (Adrian Miranda) writes: >System V does not have ftruncate. However, I believe someone once >posted a replacement that was supposed to work on System V release >3.2. You can use the fcntl(fd,F_CHSIZE,size) to emulate the function of ftruncate(). -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170
guy@auspex.auspex.com (Guy Harris) (09/08/90)
>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. S5R4's "native" interface for doing that is the F_FREESP "fcntl" call. "truncate()" and "ftruncate()" exist in the standard library as wrappers around that "fcntl()".