Advertisement
Guest User

Untitled

a guest
May 20th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. void oficina::AbrirOficina(char *nombrefichero) {
  2.  
  3. int numtecnicos, numdeclarantes, finaltec = 0;
  4. tecnico tecnicoAUX;
  5. tecnicof tecnicoLeer;
  6. declarante declaranteLeer;
  7.  
  8. ifstream fich(nombrefichero, ios::binary);
  9.  
  10. if (fich.fail()) {
  11. cout << "No se encuentra el fichero" << endl;
  12. }
  13. else {
  14. fich.read((char*)&numtecnicos, sizeof(int));
  15. while (!fich.eof() || finaltec < numtecnicos) {//tengo que usar el tope de tecnicos luego leer el num de declarantes y los declarantes
  16. fich.read((char*)&tecnicoLeer, sizeof(tecnicof));
  17.  
  18. tecnicoAUX.Codigo = tecnicoLeer.Codigo;
  19. strcpy(tecnicoAUX.Apellidos, tecnicoLeer.Apellidos);
  20. strcpy(tecnicoAUX.Nombre, tecnicoLeer.Nombre);
  21. tecnicoAUX.Especialidad = tecnicoLeer.Especialidad;
  22. int pos = L.longitud();
  23. L.insertar(pos+1, tecnicoAUX);//dudas a topeee
  24.  
  25. //Pasar tecnicof a tecnico
  26. //Llamar a incorporar tecnico cn el nuevo copiado
  27. finaltec++;
  28. }
  29.  
  30. finaltec = 0;
  31. fich.read((char*)&numdeclarantes, sizeof(int));
  32. while (!fich.eof() || finaltec < numdeclarantes) {//tengo que usar el tope de tecnicos luego leer el num de declarantes y los declarantes
  33. fich.read((char*)&declaranteLeer, sizeof(declarante));
  34. //Llamar a incorporar declarante
  35. finaltec++;
  36. }
  37. if (fich.eof())
  38. cout << "Final de fichero alcanzado\nTecnicos: " << numtecnicos << "\nDeclatantes: " << numdeclarantes << endl;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement