I have a file that contains 80 characters per line. I want to go to a particular line that starts with "ATOM".
I tried with fscanf(f1," %s%*[^\n]", rec)
and compare rec
with strcmp(rec,"ATOM")
, but it reads the next line from the match.
I also tried with fscanf("line_format", variables)
, but this reads somewhere else from the file.
The line is
ATOM 1 N MET A 1 36.643 -24.862 8.890 1.00 24.11 N
From this I want to read character by character and assign it to variables. I have a problem with the float
values and spaces. If I find a space in a place of particular variable how do I read it? How do I read the float
values if there is no space between them?