hit a stumbling block in program
hi, i have hit a stumbling block in a program i am trying to create and i cannot get round it. Kind of related to a previous post a while ago but ive come across a different problem. I have put the basic structure of my code below but i starts by positioning myself in a file at STARTOFROOT variable. From the variable i parse through 16384 bytes of data in differnet chunk sizes. Anyway ive got this part sorted however im having trouble with the next part. At various points in the 16384 bytes i will come across bytes that contain a flag value which basically will point to another part of my file for which i need to start the whole process again but at a new value given to STARTOFROOT. I tried implimenting 'if' statements into the code at these various points but it just got out of hand and messy.
My other problem is these new values can appear any number of time and at any point within the 16384 bytes. Therefore if itt appears at the first 100 bytes and i pass the new value to STARTOFROOT then i miss out processing the rest of that particular section as the file stream moves to the next part of the file.
I hope im explaining myself well enough here but on paper I seem to think a solution would be process all the bytes in the first section. Whilst processing make a note of each flag that contains a value to move to a new part of the file. Then go to each of these values and repeat the process again for each new place.......i think the word im looking for is "recursive?"
Im having real problems developing a sensible solution for this and i was hoping that maybe you guys could suggest any ideas/advice?
f.seekg(STARTOFROOT) //starts at a particular point in a file
for loop (for 16384)
Processing the files in differnent sized chunks depending on what values each byte has