Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 21st, 2012  |  syntax: None  |  size: 0.99 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. C   reading from a file
  2. ATOM      1  N   PRO     1     -38.396  -1.525   2.011 -0.18 14.01
  3. ATOM      2  CA  PRO     1     -36.931  -1.372   2.090  0.08 13.02
  4. ATOM      3  C   PRO     1     -36.353  -0.411   1.059  0.35 12.01
  5. ATOM      4  O   PRO     1     -36.988  -0.061   0.086 -0.37 16.00
  6. ATOM      5  CB  PRO     1     -36.368  -2.749   1.735  0.03 14.03
  7. ATOM      6  CG  PRO     1     -37.417  -3.202   0.763  0.01 14.03
  8. ATOM      7  CD  PRO     1     -38.692  -2.893   1.489  0.08 14.03
  9.        
  10. std::string c1, c3, c4;
  11. int c2, c5;
  12. double c6, c7, c8, c9, c10;
  13.  
  14. if (!(input_stream >> c1 >> c2 >> c3 >> c4 >> c5 >> c6 >> c7 >> c8 >> c9 >> c10))
  15. {
  16.     // error
  17. }
  18.        
  19. for (std::string line; std::getline(file_stream, line); )
  20. {
  21.     std::string c1, c3, c4;
  22.     int c2, c5;
  23.     double c6, c7, c8, c9, c10;
  24.  
  25.     std::istringstream iss(line);
  26.  
  27.     iss >> c1;
  28.     if (c1 == "ATOM")
  29.     {
  30.         if (!(iss >> c2 >> c3 >> c4 >> c5 >> c6 >> c7 >> c8 >> c9 >> c10))
  31.         {
  32.             // error
  33.         }
  34.     }
  35. }