www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/07/20/10:18:18

From: Alain Magloire <alainm AT rcsm DOT ece DOT mcgill DOT ca>
Message-Id: <199907201418.KAA23375@mccoy2.ECE.McGill.CA>
Subject: Re: ftruncate
To: djgpp-workers AT delorie DOT com
Date: Tue, 20 Jul 1999 10:18:41 -0400 (EDT)
In-Reply-To: <Pine.SUN.3.91.990720114223.4115C-100000@is> from "Eli Zaretskii" at Jul 20, 99 11:53:34 am
X-Mailer: ELM [version 2.4 PL25]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

Bonjour M. Eli Zaretskii

> > An lseek()/write() will not do it, sometimes you want to create
> > a "hole" in the file by lseek()ing pass the size not ftruncate()ed
> > i.e. readjust its size.
> 
> I think on DOS lseek followed by write does produce a hole like that.
> On DOS, a write of zero bytes has the effect of adjusting the file's
> size to the current byte position.

I'm not sure I follow, so you are saying if I want to shrink a file, 
I can do that by lseek()ing back and write() 0 byte ?

To do this on Un*x I got to use ftruncate();


-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019