Skip to content
Snippets Groups Projects
Commit 9a7268ba authored by Pierre Loic Garoche's avatar Pierre Loic Garoche
Browse files

io_frontend header with new functions

parent 7ab1c5bd
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,9 @@ extern void _put_bool(FILE* file, char* n, _Bool _V);
extern void _put_int(FILE* file, char* n, int _V);
/*@ assigns \nothing; */
extern void _put_double(FILE* file, char* n, double _V);
extern void _put_float(FILE* file, char* n, float _V, int PREC);
/*@ assigns \nothing; */
extern void _put_double(FILE* file, char* n, double _V, int PREC);
#endif
......@@ -80,15 +80,30 @@ void _put_int(FILE* file, char* n, int _V){
printf("\n");
fprintf(file, "%d\n", _V);
}
void _put_double(FILE* file, char* n, double _V){
void _put_float(FILE* file, char* n, float _V, int PREC){
if(ISATTY) {
printf("%s = ", n);
} else {
printf("'%s': ", n);
};
printf("'%.*f' ", PREC, _V);
printf("\n");
fprintf(file, "%.*f\n", PREC, _V);
fflush(file);
}
void _put_double(FILE* file, char* n, double _V, int PREC){
if(ISATTY) {
printf("%s = ", n);
} else {
printf("'%s': ", n);
};
printf("'%f' ", _V);
printf("'%.*f' ", PREC, _V);
printf("\n");
fprintf(file, "%f\n", _V);
fprintf(file, "%.*f\n", PREC, _V);
fflush(file);
}
#endif
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment