Advertisement
danpalol

esame intercorso es 3

Jun 28th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. //STRUTTURE
  6. typedef struct nodo *Lista;
  7. typedef struct nodo{
  8.     char riga[1000];
  9.     Lista next;
  10. }nodo;
  11.  
  12. //PROTOTIPI FUNZIONE
  13. void FileAcronimo(FILE *testo);
  14. void stampalista(Lista list);
  15.  
  16.  
  17. int main ()
  18. {
  19.     FILE *pasquale;
  20.  
  21.     pasquale=fopen("ciaccarella bella.txt", "r");
  22.     FileAcronimo(pasquale);
  23.     fclose(pasquale);
  24.    
  25.     return 0;
  26. }
  27.  
  28. void FileAcronimo(FILE *testo)
  29. {
  30.     FILE *totore;
  31.     nodo *N;
  32.     Lista L=NULL;
  33.     int count=0,al=0,asd=0;
  34.     char cala[1000],lota[1000];
  35.     totore=fopen("primicaratteri.txt","w");
  36.     while(!feof(testo))
  37.     {
  38.         fgets(cala,1000,testo);
  39.         N=malloc(sizeof(nodo));
  40.         strcpy(N->riga,cala);
  41.         N->next=L;
  42.         L=N;
  43.         lota[count]=L->riga[0];
  44.         count++;
  45.         printf("%c",lota[asd]);
  46.         asd++;
  47.     }
  48.         while(al<count)
  49.         {
  50.             fprintf(totore,"%c",lota[al]);
  51.             al++;
  52.         }
  53.         fclose(totore);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement