int main( int argc, char **argv) { FILE *header; FILE *source = fopen("table.c", "w"); if (source == NULL) { perror("table.c"); return 1; } header = fopen("table.h", "w"); if (header == NULL) { perror("table.h"); return 1; } fprintf(header, "#ifndef _TABLE_H\n#define _TABLE_H\n#define qual_nn %f\n", log(0.25)); buildmatrix(header, source, "qual_match", match); buildmatrix(header, source, "qual_mismatch", mismatch); buildlist(header, source, "qual_nmatch", nmatch); buildlist(header, source, "qual_score", score); fprintf(header, "#endif\n"); fclose(source); fclose(header); return 0; }
database* getrecord (FILE* file) { char inp[128]; char name[16]; double matrix[10][10]; int i, j; database* build; fgets(inp,128,file); if (feof(file)) { return NULL; } rewrite(inp, name); build = createrecord(atoi(name));/* przepisany klucz */ rewrite(inp, name); build->index = atoi(name);/* przepisany index */ for(i=0;i<16;i++)name[i]=' '; fgets(inp,128,file);sscanf(inp," %s ",name); for(i=0;i<16;i++){build->name[i] = name[i];} /* name przepisane */ fgets(inp,128,file); cutit(inp); i = buildmatrix (inp,matrix); build->size = i; for(i=0;i<10;i++) { for(j=0;j<10;j++) { build->matrix[i][j] = matrix[i][j]; } } fgets(inp,128,file); return build; }