PIPS
io.c
Go to the documentation of this file.
1 /*
2 
3  $Id: io.c 1641 2016-03-02 08:20:19Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25 /* package arithmetic
26  *
27  * IO on a Value
28  */
29 #ifdef HAVE_CONFIG_H
30  #include "config.h"
31 #endif
32 #include <stdio.h>
33 #include <string.h>
34 
35 #include "arithmetique.h"
36 
38 {
39  (void) printf(VALUE_FMT, v);
40 }
41 
42 void fprint_Value(FILE *f, Value v)
43 {
44  (void) fprintf(f, VALUE_FMT, v);
45 }
46 
47 void fprint_string_Value(FILE *f, char * blah, Value v)
48 {
49  fputs(blah,f);
50  fprint_Value(f, v);
51 }
52 
53 void sprint_Value(char *s, Value v)
54 {
55  (void) sprintf(s, VALUE_FMT, v);
56 }
57 
58 int fscan_Value(FILE *f, Value *pv)
59 {
60  return fscanf(f, VALUE_FMT, pv);
61 }
62 
63 int scan_Value(Value *pv)
64 {
65  return scanf(VALUE_FMT, pv);
66 }
67 
68 int sscan_Value(char *s, Value *pv)
69 {
70  return sscanf(s, VALUE_FMT, pv);
71 }
72 
73 /* this seems a reasonnable upperbound
74  */
75 #define BUFFER_SIZE 50
77 {
78  static char buf[BUFFER_SIZE];
79  sprintf(buf, VALUE_FMT, v);
80  return buf;
81 }
#define VALUE_FMT
int Value
char * Value_to_string(Value v)
Definition: io.c:76
int fscan_Value(FILE *f, Value *pv)
Definition: io.c:58
#define BUFFER_SIZE
this seems a reasonnable upperbound
Definition: io.c:75
void sprint_Value(char *s, Value v)
Definition: io.c:53
int scan_Value(Value *pv)
Definition: io.c:63
void print_Value(Value v)
package arithmetic
Definition: io.c:37
int sscan_Value(char *s, Value *pv)
Definition: io.c:68
void fprint_Value(FILE *f, Value v)
Definition: io.c:42
void fprint_string_Value(FILE *f, char *blah, Value v)
Definition: io.c:47
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
int printf()
static char buf[BSZ]
Definition: split_file.c:157