Advertisement
Guest User

Untitled

a guest
May 31st, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. void ficheirolerclientes(listaclientes cliente){
  2. char linha[100];
  3. char nomecliente[100];
  4. char cc[100];
  5.  
  6.  
  7. FILE *fp;
  8. fp = fopen("viagens.txt", "r");
  9.  
  10. if(fp == NULL){
  11. printf("Erro ao abrir ficheiro!(leitura)");
  12. return;
  13. }
  14.  
  15. while(fgets(linha, 200, fp) != NULL){
  16.  
  17. strcpy(nomecliente, strtok(linha, "-"));
  18. strcpy(cc, strtok(NULL, ";"));
  19.  
  20. cliente->cc=atoi(cc);
  21.  
  22. Insere_cliente_fim(cliente, nomecliente, cc);
  23.  
  24. }
  25.  
  26.  
  27. fclose(fp);
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement