How to parse a tar file in C++
- by Brendan Long
What I want to do is download a .tar file with multiple directories with 2 files each. The problem is I can't find a way to read the tar file without actually extracting the files (using tar).
The perfect solution would be something like:
#include <easytar>
Tarfile tar("somefile.tar");
std::string currentFile, currentFileName;
for(int i=0; i<tar.size(); i++){
file = tar.getFileText(i);
currentFileName = tar.getFileName(i);
// do stuff with it
}
I'm probably going to have to write this myself, but any ideas would be appreciated..