I have a txt file with time series data. So want to write a code which reads from the file but in pieces i.e. It reads the data to a certain point then it computes a value, then it starts reading the data from the point where it stopped to anothepoint, the code does the computation again and so on and so on... I gogoled but I couldnot find any clue how to start...
Use getline, if the current line is a midway point between 2 sets of data you need to compute then you can just use a find_first_of or substr(n, n) or some such; Check string class and the examples here: http://cplusplus.com/doc/tutorial/files/
otherwise if each set of data is on a separate line then it's even easier just using getline() otherwise if you need to place the whole file in memory for processing guidelines are also on the tutorial