Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if((p_f2=fopen(FILE_RETTE),"rb")==NULL) goto fopen_err;
- if((fread(&n_c,sizeof(int),1,p_f2)!=1) goto fread_err;
- if((p_r=(pretta)malloc(sizeof(retta)*n_c))==NULL) goto mem_err;
- if((fread(p_r,sizeof(float),n_c,p_f2)!=n_c) goto fread_err;
- fclose(p_f2);
- for(i=0;i<n_c;i++)
- {
- printf("La retta %d e': %fx+%fy+%f=0\n",(i+1),p_r[i].a,p_r[i].b,p_r[i].c);
- }
- return EXT_SUCCESS;
- fopen_err: printf("C'e' un èproblema nell'apertura del file.\n"); return EXIT_FAILURE;
- fread_err: printf("Il numero acquisito non coincide con quello inserito.\n"); return EXIT_FAILURE;
- mem_err: printf("Non c'e' abbastanza spazio in memoria.\n"); return EXIT_FAILURE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement