Mail Archives: djgpp/1998/04/16/20:03:45
From: | "Jeremy Lounds" <jlounds AT bigfoot DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Allegro Packfile routines vs. <stdio> functions...
|
Date: | Thu, 16 Apr 1998 10:59:47 -0400
|
Lines: | 49
|
NNTP-Posting-Host: | 209.153.168.134
|
Message-ID: | <35361d1d.0@news10.kcdata.com>
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hello, Everyone! I am working on a game, and I need to re-write the file
loading from the orginal 3D engine. Here is the old routine and the one that
I am having trouble with. Any help would be greatly appreciated!
Jeremy Lounds
http://morton-av.hypermart.net
The old one:
long int FileRead(char *Name, long int Start, long int Len, void *buffer)
{
int handle;
long int size;
handle=open(Name,O_RDONLY|O_BINARY);
lseek(handle,Start,SEEK_SET);
size=read(handle,buffer,Len);
close(handle);
return(size);
}
And here is mine that fails at _pack_fread :
long int FileRead(char *Name, long int Start, long int Len, void *buffer)
{
PACKFILE *the_file;
char mFilename[20];
long int size;
sprintf( mFilename, "data.dat#%s", Name );
textout( screen, font, mFilename, 10, 10, 10 );
while( !keypressed() );
the_file=pack_fopen( mFilename, F_READ );
pack_fseek( the_file, Start );
size=pack_fread( buffer, Len, the_file );
pack_fclose(the_file);
return(size);
}
I also changed the file names that are passed to the function so that it is
a '_' instead of a '.' (ie, "MYDATA_BIN" op. "MYDATA.DAT" )
It is saved with the grabber util with no compression and no password.
Thanks again!
- Raw text -