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.c
67 67
  printf("'%i' ", (_V)? 1 : 0);
68 68
  printf("\n");
69 69
  fprintf(file, "%i\n", _V);
70
  fflush(file);
70 71
}
72

  
71 73
void _put_int(FILE* file, char* n, int _V){
72 74
  if(ISATTY) {
73 75
    printf("%s = ", n);
......
77 79
  printf("'%d' ", _V);
78 80
  printf("\n");
79 81
  fprintf(file, "%d\n", _V);
82
  fflush(file);
80 83
}
81 84

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

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

Also available in: Unified diff