Mail Archives: djgpp/2005/02/23/11:50:40
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 -