int convertCSVtoBinary() { FILE* csvFile; FILE* binFile; csvFile=fopen("records.csv","r"); binFile=fopen("records.dat","wb"); if(csvFile == NULL){ printf("Couldn't open CSV file\n"); return 1; } char row[1024]; while(fgets(row, 1024, csvFile)){ Person p; int attributeCount = sscanf(row, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%d,%[^\n]", p.name, p.surname, p.gender, p.occupancy, p.level_of_education, p.email, p.bank_account_number, p.IBAN, p.account_type, p.currency_unit, p.total_balance_available, p.available_for_loan); if (attributeCount != 12){ printf("problemli satir.\n"); } else{ fwrite(&p, sizeof(p), 1, binFile); } } fclose(binFile); fclose(csvFile); return 0; }