0
Good morning people, I have a file that contains several lines, among them the following:
REMARK Evaluations: CoarseFF Proper-dihedrals Coarse Atomic Repulsion Coarse Compaktr Hbond_Strands Hbond_Angle_Dist_var_power_Strands Hbond_AHelixes
Helix_packing_coarse HB_COOPER_coarse RR_contacts_coarse Total Energy
REMARK 914959: 119.706 63.2753 86.7273 26 237.053 28 2218.95 -48976 13.5677 933.999
I need to take the third line shown there, the second in which appears "REMARK". More specifically, the last numerical value of this line, the value "933.999".
I’m doing like this:
while(!feof(arquivo))
{
fgets(linha_do_arquivo, 1000, arquivo);
if( (strstr(linha_do_arquivo, "REMARK") == linha_do_arquivo) && (strstr(linha_do_arquivo, "Evaluations:") != linha_do_arquivo+7) )
{
sscanf(linha_do_arquivo, "%*s %*s %*s %*s %*s %*s %s", valor_numérico);
}
}
However, I wanted to know if there is something to pick up the bottom line, something like "if line start == Helix, fgets+1", or whatever. I think you can do with fgets, but I do not know how. Someone can help me?
Any other suggestion is also welcome! =)
Apparently not, if I understand correctly.
fgets()
will read bytes, that’s all, you have to create the algorithm you want with the information read.– Maniero