delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/02/23/11:50:40

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <421CADBF.5070800@eik.bme.hu>
Date: Wed, 23 Feb 2005 17:22:23 +0100
From: solyom <solyom AT eik DOT bme DOT hu>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.1) Gecko/20040707
X-Accept-Language: hu, en-us, en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: files > 4GB There is always a solution
References: <f7 DOT 4a46b646 DOT 2f459ddb AT aol DOT com> <01c51526$Blat.v2.4$4f49bbe0 AT zahav DOT net DOT il> <1108717860 DOT 986391 DOT 55760 AT o13g2000cwo DOT googlegroups DOT com>
In-Reply-To: <1108717860.986391.55760@o13g2000cwo.googlegroups.com>
Reply-To: djgpp AT delorie DOT com

Hi,

I once lead a team that wrote a program for the Commodore 128 (datamat 
128 for Data Becker Gmbh) which used larger logical files than would 
have fitted on one side of its two sided floppy drive. And no file could 
cross the floppy side. I think the same simple technique I developed for 
that project may be used here too.
In C++:
     Create a LARGFILE class which physically uses  two < 2Gb files as 
one logical unit! This class would implement file operations using 64 
bit offsets.
E.g.
       typedef long long LARG_OFFS ;
       class LARGFILE {
             char *name;   // logical file name. The name of the 
physical files  could be e.g. the same name prepended with a number
                                  // but you are free to use any names 
you like
             FILE *f1, *f2;   // the two physical files
        public:
             LargeOpen(char *name, char *mode);
             LargeSeek(LARG_OFFS *, int whence);
             LargeRead(char *buff, long size);   // you may have longer 
reads than 2GB ...
             LargeClose();
       };
            
In C:
     you may use a struct instead a class and use separate 64 bit 
functions.

In both cases your application could see the files as one logical unit.

Andras

- Raw text -


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