diff options
Diffstat (limited to 'charf.c')
| -rw-r--r-- | charf.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -475,14 +475,15 @@ void print_records(EXPTYPE exponents[P], VALUETYPE ratios[K+1][P], index_t indec printf("%s\n",s); } -void print_latex_records_to_file(EXPTYPE exponents[P], VALUETYPE ratios[K+1][P], index_t indeces[K+1][P], char* filename){ +void print_records_to_file(EXPTYPE exponents[P], VALUETYPE ratios[K+1][P], index_t indeces[K+1][P], char* filename, int format){ char s[STRING_SIZE]; - format_results(s, exponents, ratios, indeces, FORMAT_LATEX); + format_results(s, exponents, ratios, indeces, format); FILE *fptr; fptr = fopen(filename, "w"); fprintf(fptr, "%s\n",s); fclose(fptr); + printf("File \"%s\" written.\n",filename); } /*information given to each thread*/ @@ -570,9 +571,12 @@ int main() { if(finished >= NUM_THREADS) user_input_cont = false; } else if( 0 == strcmp(buff,"r")) print_records(exponents,records_ratio,records_index); - else if( 0 == strcmp(buff,"t")){ + else if( 0 == strcmp(buff,"t")*strcmp(buff,"p")){ + int format = 0; + if( 0 == strcmp(buff,"p")) format = FORMAT_TEXT; + else if( 0 == strcmp(buff,"t")) format = FORMAT_LATEX; getLine("Enter file name:\n", buff, sz); - print_latex_records_to_file(exponents,records_ratio,records_index,buff); + print_records_to_file(exponents,records_ratio,records_index,buff,format); } } while(user_input_cont); |
