Replacement for ftruncate() on non-BSD systems

Stefan Stapelberg stefan at mikros.systemware.de
Tue Oct 18 09:20:44 AEST 1988


[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 at mecky.systemware.de
			Rest of the world: walter%mecky at mikros.uucp

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



More information about the Comp.unix.questions mailing list