Go through these lessons:
The getline function reads the file line by line and can be used to return a string of a line in the file to either stdout, a variable, a file, etc.
Maleeha Basically, you will have to loop through all lines in the file and save them to some form of data container that you can then access a line by an index to the container. Or, you can loop through all lines in the file until a desired number of lines is reached and then store that specific line.
I'm saving data of guests in file and after checkout their data has to be removed and file is to be updated ..if the data of 2 guest is from line 7 to line 10 ,how will I access it without having to read file from the start and how will it end before end of file ?