Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. //modulo para cargar los viajes de un archio (loadLog)
  2. void loadLog(Lista &list,Trip &viaje,string &fichero){
  3.  
  4. //string fichero;
  5. string km;
  6. string seg;
  7. string lit;
  8. string esp;
  9. char para;
  10. char cor;
  11.  
  12.  
  13.  
  14. ifstream f(fichero.c_str());
  15.  
  16. if(f.is_open()){ //si el fichero esta abierto
  17.  
  18. borrarLista(list);
  19.  
  20. string s="";
  21.  
  22. while(f>>viaje.km && !f.eof()){
  23. f>>km;
  24.  
  25. f>>viaje.time;
  26. f>>seg;
  27.  
  28. f>>viaje.consumption;
  29. f>>lit;
  30.  
  31. f>>para;
  32.  
  33. f>>viaje.kminitial;
  34. f>>viaje.kmhv;
  35. f>>viaje.kmfinal;
  36.  
  37. f>>esp;
  38. f>>cor;
  39.  
  40. f>>viaje.tinitial;
  41. f>>viaje.thv;
  42. f>>viaje.tfinal;
  43.  
  44. f>>cor;
  45.  
  46. introducirDatos(list,viaje);
  47. }
  48. f.close(); //cerramos fichero
  49. }else{ //quiere decir que no se ha podido abrir el fichero
  50. cout<<"Error, can't open file"<<endl;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement