Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C reading from a file
- ATOM 1 N PRO 1 -38.396 -1.525 2.011 -0.18 14.01
- ATOM 2 CA PRO 1 -36.931 -1.372 2.090 0.08 13.02
- ATOM 3 C PRO 1 -36.353 -0.411 1.059 0.35 12.01
- ATOM 4 O PRO 1 -36.988 -0.061 0.086 -0.37 16.00
- ATOM 5 CB PRO 1 -36.368 -2.749 1.735 0.03 14.03
- ATOM 6 CG PRO 1 -37.417 -3.202 0.763 0.01 14.03
- ATOM 7 CD PRO 1 -38.692 -2.893 1.489 0.08 14.03
- std::string c1, c3, c4;
- int c2, c5;
- double c6, c7, c8, c9, c10;
- if (!(input_stream >> c1 >> c2 >> c3 >> c4 >> c5 >> c6 >> c7 >> c8 >> c9 >> c10))
- {
- // error
- }
- for (std::string line; std::getline(file_stream, line); )
- {
- std::string c1, c3, c4;
- int c2, c5;
- double c6, c7, c8, c9, c10;
- std::istringstream iss(line);
- iss >> c1;
- if (c1 == "ATOM")
- {
- if (!(iss >> c2 >> c3 >> c4 >> c5 >> c6 >> c7 >> c8 >> c9 >> c10))
- {
- // error
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment