Revision a9b87a15
Added by Pierre-Loïc Garoche about 5 years ago
include/io_frontend.hpp | ||
---|---|---|
70 | 70 |
printf("\n"); |
71 | 71 |
fprintf(file, "%i\n", _V); |
72 | 72 |
} |
73 |
|
|
73 | 74 |
void _put_int(FILE* file, char* n, int _V){ |
74 | 75 |
if(ISATTY) { |
75 | 76 |
printf("%s = ", n); |
... | ... | |
80 | 81 |
printf("\n"); |
81 | 82 |
fprintf(file, "%d\n", _V); |
82 | 83 |
} |
84 |
|
|
85 |
void _put_float(FILE* file, char* n, float _V){ |
|
86 |
if(ISATTY) { |
|
87 |
printf("%s = ", n); |
|
88 |
} else { |
|
89 |
printf("'%s': ", n); |
|
90 |
}; |
|
91 |
printf("'%.*f' ", PREC, _V); |
|
92 |
printf("\n"); |
|
93 |
fprintf(file, "%.*f\n", PREC, _V); |
|
94 |
} |
|
95 |
|
|
83 | 96 |
void _put_double(FILE* file, char* n, double _V){ |
84 | 97 |
if(ISATTY) { |
85 | 98 |
printf("%s = ", n); |
86 | 99 |
} else { |
87 | 100 |
printf("'%s': ", n); |
88 | 101 |
}; |
89 |
printf("'%f' ", _V);
|
|
102 |
printf("'%.*f' ", PREC, _V);
|
|
90 | 103 |
printf("\n"); |
91 |
fprintf(file, "%f\n", _V);
|
|
104 |
fprintf(file, "%.*f\n", PREC, _V);
|
|
92 | 105 |
} |
93 | 106 |
|
94 | 107 |
#endif |
Also available in: Unified diff
Extending types to machine types