www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/10/20:56:05

From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: I'd like to truncate a file but I don't know how
Date: Mon, 10 Feb 1997 19:50:44 GMT
Organization: Oxford University
Lines: 24
Message-ID: <32ff7b0a.19732386@news.ox.ac.uk>
References: <rkg1z4ahec DOT fsf AT taz DOT dra DOT hmg DOT gb>
NNTP-Posting-Host: mc31.merton.ox.ac.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 10 Feb 1997 14:02:19 +0000, Ian Miller <itmiller AT dra DOT hmg DOT gb> wrote:

>I'd like to say "truncate this file here" in one of my programs.
>
>Can I/how do I do this with standard C/C++?

Yes

>Can I/how do I do this with non-standard features of DJGPP C/C++?

You don't need to.

>At the moment, if I delete a word from a file (a dictionary file
>as it happens) and shift everything down to reclaim the space,
>I'm left with a load of spare space at the end that I can't get
>rid of.

Post some code demonstrating what you're doing... i.e. what functions
you are using to open and read the file, and how you're writing back
to the file.

Also look up: info libc a ftruncate

George Foot

- Raw text -


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