I have a pretty simple problem with C ++, but based on the C-background, I don't know all the features of C ++ I / O. So here is the problem:
I have a simple .txt file with a specific format, the text file looks like this:
123 points are stored in this file
pointer number | x-coordinate | y-coordinate
0 1.123 3.456
1 2.345 4.566
.....
I want to read the coordinates. How can i do this? The first step is fine:
int lines;
ifstream file("input.txt");
file >> lines;
It stores the first number in the file (i.e. 123 in the example) in lines. Now I would like to iterate over the file and read only the x and y coordinates. How can I do this efficiently?
Chris source
share