Truncating an existing file (and lockf question)

john.urban urban at cbnewsl.att.com
Fri Apr 26 01:21:21 AEST 1991


In article <1991Apr25.144430.350 at wrkgrp.COM> ets at wrkgrp.COM (Edward T Spire) writes:
>In article <16836 at chaph.usc.edu> jeenglis at alcor.usc.edu (Joe English) writes:
>SCO/Unix.  W/ SCO/Unix, chsize() takes the same parms as
>ftruncate() and does the same thing...
>
>========================================================================

chsize is also available for UNIX System V/386 Release 3.2, and UNIX System V/386
Release 4.0.  Little example ...

$ cat C.c
#include <fcntl.h>
main()
{
	int a;
	a = open("/tmp/passwd", O_WRONLY);
	chsize (a, 20L);
	close (a);
}
$ cp /etc/passwd /tmp/passwd
$ cc -O C.c -o C -lx
$ ./C
$ ls -l /tmp/passwd
-r--r--r-- 1 install other  20 Apr 25 11:17 /tmp/passwd


Sincerely,

John Urban



More information about the Comp.unix.questions mailing list