I am developing a visual c++ application . i need to know the file type (i mean whether it contains .png file or.html file or .txt file) present inside the tar file(just by c++ prgramming)-Nothing to deal with the commands. I have got some knowledge on the link below- how to parse a tar file here i have got information that at buffer[512] we have contents of a file present inside thge tar file.My first quesion is
(1.) suppose if i have more then 1 files present in tar and i got the size from the location (&buffer[124], 11); and from 512 to size of the file i had conntents of that file and i stored it in a buffer for my personal use.But as i understand this rule of (contents start from 512 location) is valid for the file present at the first position in the tar file. What if i have to get the position, contents and size of the file which is at 3/4 positions(what if am not sure about the position of the file present in the tar file) ???
(2.) Am i thinking right ??? if i have to go to next file contents i have to do 512*2 (because first file contents starting at 512 location so the next file will be having at 1024- I am sure its a wrong approach but could any one please correct it ??).
Actually i have to store only Html file contents in my buffer from the tar file(which contains number of files of different type)