I have a file with N blocks of data. There is a space of two empty rows between them. I would like to make a script in c++ that read only the last block in order to make more calculations and graphics with those data. How can I do that? Thanks.
Open file.
Read first block into memory
Read next block, overwriting the first block in memory.
Read next block, overwriting the first block in memory.
...
Eventually, there will be no next block and the data in memory will be from the last block.
Yes, that is a possibility, but maybe I have a lot of blocks, thousands of them. There is something more efficient and elegant, like going to the end of the file and then go back the size of one block?
Yes. There are represented the position of N particle in each block. So there are a lot of blocks (unknown number), but all of them are formed by N rows and 2 column (position of particles in 2-D).
N can be establish at run time, the blocks are composed of double precision real numbers between 0 and 1200 and the rows could have different number of columns because numbers can be different.