Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstdlib>
  4. #include <string>
  5. #include <cstdio>
  6. #include <cerrno>
  7.  
  8. using namespace std;
  9.  
  10. struct espion
  11. {
  12. char nom[30];
  13. char pays[20];
  14. char emploi[29];
  15.  
  16. };
  17.  
  18.  
  19. int main()
  20. {
  21. const int MAX_NOM = 30, MAX_PAYS = 20, MAX_EMPLOI = 29;
  22. char nomFichier[50] = "espion.txt";
  23.  
  24.  
  25.  
  26. ifstream aLire;
  27. aLire.open(nomFichier, ios::in|ios::binary);
  28.  
  29. if(!aLire.is_open()){
  30. exit(EXIT_FAILURE);
  31. }
  32.  
  33.  
  34. std::string infoEspion;
  35.  
  36.  
  37. while(aLire)
  38. {
  39. infoEspion.clear();
  40. std::getline(aLire, infoEspion);
  41. cout << infoEspion ;
  42.  
  43. }
  44.  
  45. aLire.close();
  46.  
  47.  
  48. system("pause");
  49. return 0;
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement