Project

General

Profile

« Previous | Next » 

Revision 65de9931

Added by Pierre-Loïc Garoche about 5 years ago

New feature to specify the number of digits to be printed

View differences:

include/io_frontend.hpp
69 69
  printf("'%i' ", (_V)? 1 : 0);
70 70
  printf("\n");
71 71
  fprintf(file, "%i\n", _V);
72
  fflush(file);
72 73
}
73 74

  
74 75
void _put_int(FILE* file, char* n, int _V){
......
80 81
  printf("'%d' ", _V);
81 82
  printf("\n");
82 83
  fprintf(file, "%d\n", _V);
84
  fflush(file);
83 85
}
84 86

  
85
void _put_float(FILE* file, char* n, float _V){
87
void _put_float(FILE* file, char* n, float _V, int PREC){
86 88
  if(ISATTY) {
87 89
    printf("%s = ", n);
88 90
  } else {
......
91 93
  printf("'%.*f' ", PREC, _V);
92 94
  printf("\n");
93 95
  fprintf(file, "%.*f\n", PREC, _V);
96
  fflush(file);
94 97
}
95 98

  
96
void _put_double(FILE* file, char* n, double _V){
99
void _put_double(FILE* file, char* n, double _V, int PREC){
97 100
  if(ISATTY) {
98 101
    printf("%s = ", n);
99 102
  } else {
......
102 105
  printf("'%.*f' ", PREC, _V);
103 106
  printf("\n");
104 107
  fprintf(file, "%.*f\n", PREC, _V);
108
  fflush(file);
105 109
}
106 110

  
111

  
107 112
#endif

Also available in: Unified diff