#include #include #include #define NMAX 200 void nuovastr(char *,char *); struct mystruct { char s1[NMAX]; char s2[NMAX]; int l1; int l2; } ; typedef struct mystruct MyStruct; void ordina(MyStruct v[]); int main() { MyStruct v[100]; FILE *fp; char s1[NMAX],s2[NMAX]; char *ps; int k=0; fp=fopen("input.txt","r"); if(fp!=NULL) { do{ ps=fgets(s1,NMAX,fp); printf("%s\n",s1); nuovastr(s1,s2); printf("%s\n",s2); v[k].l1=strlen(s1); v[k].l2=strlen(s2); strcpy(v[k].s1,s1); strcpy(v[k].s2,s2); k++; }while(ps!=NULL); fclose(fp); fp=fopen("output.bin","w"); if(fp!=NULL) { fwrite(v,sizeof(MyStruct),k,fp); fclose(fp); } } else printf("Errore apertura file\n"); return 0; } int conta(char *s, char c){ int cont=0; for(int i=0;i='a')) { if ( conta(s2,s1[i])==0) { s2[j++]=s1[i]; s2[j++]=conta(s1,s1[i])+'0'; } } } s2[j]='\0'; }