Quote:
Originally Posted by Alkass
how would it possible to read in c++ each <block> separately ?
|
I can't guess what you mean by that.
What output do you want to produce or what processing are you trying to do?
Quote:
I have something like this bellow, but can get it to work it recursively.
|
I assume you meant "can't" not "can". But what about it should be recursive?
Are blocks nested? Your example did not show blocks nested.
If you want a non recursive function to process nested blocks, you probably want your variable begin_tag to be a count rather than a bool. It should hold the number of blocks that have started but not completed. If blocks can't nest then that number is just 0 or 1 depending on whether you are reading inside or outside a block. But if blocks can nest then it can go higher than 1.
If you want to recursively process blocks that can nest, you want a function that can be called at the beginning or can be called right after reading a block even, then it reads up to either the end of the block or end of the file. If it sees a nested block, it calls itself to process that nested block.