delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/02/20:15:29

Message-ID: <395FD105.832B3B@user.rose.com>
From: April <awhite AT user DOT rose DOT com>
X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {TLC;RETAIL} (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ftruncate function
References: <395E8D99 DOT 5FF683 AT user DOT rose DOT com> <200007021919 DOT WAB26553 AT alpha DOT netvision DOT net DOT il>
Lines: 25
Date: Sun, 02 Jul 2000 18:32:22 -0500
NNTP-Posting-Host: 205.189.215.24
X-Trace: client 962576890 205.189.215.24 (Sun, 02 Jul 2000 18:28:10 EDT)
NNTP-Posting-Date: Sun, 02 Jul 2000 18:28:10 EDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:

> Please post a short test program that could be compiled and used to

For the second call to ftruncate(), redefine MY_MAX.  My HD has 320MB
free, so it should fail at 400

#include <stdio.h>
#include <unistd.h>
#include <io.h>

#define MY_MAX 400

int main( int argc, char *argv[] )
{
  int h = _creat( "testtr.fil", 0 );
  printf( "file len : %ld\n", filelength( h ) );
  printf( "ftruncate: %d\n", ftruncate( h, 1024 * 1024 ) );
  printf( "file len : %ld\n", filelength( h ) );
  printf( "ftruncate: %d\n", ftruncate( h, 1024 * 1024 * MY_MAX ) );
  printf( "file len : %ld\n", filelength( h ) );
  _close( h );
  return 0;
}

- Raw text -


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