libarchive reads too many chars when extracting a file
- by ojreadmore
I've written a C program to extract files from a tar archive using libarchive.
I'd like to extract a file from this archive and print it to standard output. But I get extra characters. It's garbage, but it's from another file (possibly adjacent to it in the archive.) I expect output to end at </html>.
Here is the code that reads this tar file.
libarchive 2.8.3 compiled on mac os X 10.6.3. gcc 4.2 x86_64
ls -l vendar-definition.html gives me 1921 for the file size. And so shows tar tfv 0000.tar | grep vendar-definition.html. So reports the C output that states the file size. To me this seems correct.
Two possibilities I can see for why my output is not as expected: 1. I've made a beginner's mistake or 2. multibyte characters in the archive files has something to do with it.