[comp.unix.questions] Replacement for ftruncate

stefan@mikros.systemware.de (Stefan Stapelberg) (10/18/88)

[I am sending this for a friend, please reply by e-mail. -Stefan]

Dear Netlanders,

in BSD systems there is a system call ftruncate(2)
with the following syntax:

	ftruncate(fd, size).

The call truncates the file corresponding to the
file descriptor "fd" to the new "size".
XENIX has "chsize(2)" which works similar.

I don't have BSD and I don't have XENIX (guess my system :-),
but I recently got software from the net using ftruncate().

Does anybody know/have an implementation of a function, which
does the job ? It would suffice, if the function would only 
truncate to size 0.

Note: creat(2) ist no replacement, because it needs a file
      name, but ftruncate() gets a file descriptor only.

Thanks for any hints.

-- 
Walter Mecky			  Germany: walter@mecky.systemware.de
			Rest of the world: walter%mecky@mikros.uucp

-- 
MIKROS Systemware	stefan@mikros.UUCP, {uunet,mcvax}!unido!mikros!stefan
Stefan Stapelberg	stefan@mikros.systemware.de, stefan@ira.uka.de
Phone +49 9352 5948	^D: These are my employer's opinions - you wonder why?