I’m trying to read some xyz coordinates from an input file.
This is the input file I have:
input.inp
POSITIONS
1.5 2.5 1.5 C
3.2 1.5 4.5 C
1.4 4.2 3.2 C
I want to write a function that searches the input file for the string containing " C" and then starting reading the coordinates from that line. How do I do this in c++? (I don’t want to search for the the word POSITIONS, as that part of the input file may change later).
1 Answer