# File Archive question

## 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];

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

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 :)

## Create an account

Register a new account

• ## Partner Spotlight

• ### Forum Statistics

• Total Topics
627638
• Total Posts
2978327

• 10
• 12
• 22
• 13
• 34