Missing ftruncate

Simon Marlow simonmar at microsoft.com
Tue Jan 4 11:39:50 EST 2005


On 20 December 2004 22:01, John Goerzen wrote:

> There appears to be no interface in Haskell to ftruncate(2).  (Or, for
> that matter, the less-useful truncate(2)).

There are System.Posix.setFileSize and System.Posix.setFdSize, which are
direct interfaces to truncate(2) and ftruncate(2) respectively.

However, perhaps you want something more portable.  I seem to recall
there was a proposal to add hSetFileSize at one point... ah yes:

http://www.haskell.org/pipermail/haskell/2002-January/008677.html

unfortunately we never followed up on that promise :-)  Looks like it
shouldn't be too hard - on Windows there's no truncate(), but there is
SetEndOfFile() instead.

Cheers,
	Simon


More information about the Libraries mailing list