From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,84743f7cf2a8571a,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1995-03-29 17:23:10 PST Path: nntp.gmd.de!news.rwth-aachen.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!xlink.net!howland.reston.ans.net!news.sprintlink.net!opal.cybergate.com!emerald!olson From: olson@emerald.cybergate.com (Brian Olson) Newsgroups: comp.unix.osf.osf1 Subject: How to portably truncate a file? Date: 30 Mar 1995 00:27:34 GMT Organization: Cybergate Information Services Message-ID: <3lcttm$csr@opal.cybergate.com> NNTP-Posting-Host: emerald.cybergate.com X-Newsreader: TIN [version 1.2 PL2] 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 bolson@arcada.com