Public Group

# 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.

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

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632997
• Total Posts
3009791
• ### Who's Online (See full list)

There are no registered users currently online

×