Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to portably truncate a file?

0 views
Skip to first unread message

Brian Olson

unread,
Mar 29, 1995, 7:18:41 PM3/29/95
to

Greeetings gurus,

I was asked a pretty simple Unix programming question the other day,
and was suprised to realized that I didn't know the correct answer.
The question was:
Is there a portable way in Unix to truncate an existing file
to a smaller (but non-zero) length?

I know about the truncate() and ftruncate() functions introduced in
BSD4.2 or thereabouts, but these don't seem to be portable (for example,
System V Release 3.2 doesn't seem to support them).

Is there such a function that is portable?

Thanks in advance
Brian Olson
bol...@arcada.com


0 new messages