Sign in to follow this  

File Archive question

This topic is 3850 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

This topic is 3850 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this