Jump to content
  • Advertisement
Sign in to follow this  

File Archive question

This topic is 4161 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hiya, I'm just designing a file archiving system, and I'm not sure which of the two methods I'm considering to use. I have an interface called IArchiveReader, and I'm wondering if it's worth implementing a seperate class for the file headers that are in the archive files. I'll try and demonstrate how each way would be used to try and explain better.
IArchiveReader *pReader;

// first method
int iIndex = pReader->GetFileIndex( "myfile.bmp" );

int iSize = pReader->GetFileSize( iIndex );

char *pBuffer = new char[iSize];
pReader->GetFileData( iIndex, pBuffer, iSize );

// or, second method
int iIndex = pReader->GetFileIndex( "myfile.bmp" );

IArchiveFileHeader *pHeader;
pHeader = pReader->GetFileHeader( iIndex );

int iSize = pHeader->GetSize();
char *pBuffer = new char[iSize];

pReader->GetFileData( iIndex, pBuffer, iSize );
Using only the reader class seems easier to use, but using a file header class seems more object-oriented and could be handy when I need to write archive files. I know its only a small detail, but any thoughts would be appreciated :)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!