Date: Mon, 12 Dec 94 20:21 MST From: mat AT ardi DOT com (Mat Hostetter) To: djgpp AT sun DOT soe DOT clarkson DOT edu Cc: IBBT0 AT cc DOT uab DOT es Subject: Re: Help about truncating files References: <01HKK6FUXGXU8WZEM3 AT cc DOT uab DOT es> <9412121810 DOT AA25037 AT delorie> >>>>> "dj" == DJ Delorie writes: dj> DOS says that if you write zero bytes, the file is truncated dj> where the pointer is. With FILE* streams, this is tricky dj> (because of the caching), but what you can do is this: dj> fflush(f); dj> lseek(fileno(f), POS, 0); dj> write(fileno(f), 0, 0); ftruncate() in the djgpp C library does exactly this, but without the fflush(). -Mat