How to parse the file using C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Man4ish
    New Member
    • Mar 2008
    • 151

    How to parse the file using C++

    Hi ,
    I am trying to parse one file sdf format having molecule information.
    e.g
    1 2
    2 3
    4 6
    4 7
    $$$$
    9 2
    4 3
    6 6
    4 7
    $$$$
    1 2
    2 3
    2 6
    4 9
    $$$$

    There are three molecules each ending with $$$$. I am able parse the information for each molecule but how can i get different -different molecule ,is there any split and join function like Perl so that i can join the file with newline and split the file into different molecule using split function (tokenizer $$$$).If yes please help me out of this pblm.
    Thankyou very much in advance.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    I'm not sure I understand your problem.

    However, assuming it's just reading the file and youi know the format, why cant' use use the >> operator to read the 8 integers and then use cin.ignore() to eat rhe $$$$. That would fetch out one set of data.

    You then repeat for the other sets.

    Comment

    Working...