Allora sono riuscito a risolvere praticamente tutti i problemi (erano le free()). Adesso ho un problema solo con l'ultimo test. Vi posto il codice del test:
Questo invece è il codice da testare (scritto da me, dovrebbe essere questa parte almeno):codice:// Verifica correttezza test[numtest].testid = 10113; test[numtest].weight = 10; strcpy(test[numtest].desc, "CREATE: Verifica correttezza"); printf("Test:[%d] Peso:[%d] - [%s]\n", test[numtest].testid, test[numtest].weight,test[numtest].desc); for(;;) { ret = -1; fp = fopen("ProvaTest.dbf", "r"); len = fread(buftest, sizeof(char), 500, fp); fclose(fp); fp = fopen("Prova.dbf", "r"); len1 = fread(buf, sizeof(char), 500, fp); fclose(fp); if (len1 != len) break; // Confronto la prima parte (prima del timestamp) len = DBF_NAME_LENGTH+1+2+4+2+2; if (memcmp(buf, buftest, len)) break; // Confronto la seconda parte (dopo il timestamp) if (memcmp(buf+len+4, buftest+len+4, len1-len-4)) break; ret = LPC_OK; break; } if (ret == LPC_OK) test[numtest].passed = 1; numtest++; Result("CREATE"); }
Praticamente il test mi va in Segmentation fault, ma non capisco cosa mi sono dimenticato di allocare.codice:int ret=fwrite(h,sizeof(h),(size_t) h->dimHeader,fp); if(ret!=h->dimHeader){ char Err9[256]; (void) sprintf(Err9, "Errore di scrittura su file"); LPC_GestioneErrore(LPC_ERR_WRITE, "CreateDatabaseFile", Err9); return LPC_ERR_WRITE; } rename(Name,finale); fclose(fp);
Grazie.![]()

Rispondi quotando