GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
key_value3.c
Go to the documentation of this file.
1
16
#include <grass/gis.h>
17
29
int
G_write_key_value_file
(
const
char
*file,
30
const
struct
Key_Value *kv,
int
*stat)
31
{
32
FILE *fd;
33
34
*stat = 0;
35
fd = fopen(file,
"w"
);
36
if
(fd ==
NULL
)
37
*stat = -3;
38
else
if
(
G_fwrite_key_value
(fd, kv) != 0 || fclose(fd) == EOF)
39
*stat = -4;
40
return
(*stat != 0);
41
}
42
54
struct
Key_Value *
G_read_key_value_file
(
const
char
*file,
int
*stat)
55
{
56
FILE *fd;
57
struct
Key_Value *kv;
58
59
*stat = 0;
60
fd = fopen(file,
"r"
);
61
if
(fd ==
NULL
) {
62
*stat = -1;
63
return
NULL
;
64
}
65
kv =
G_fread_key_value
(fd);
66
fclose(fd);
67
if
(kv ==
NULL
)
68
*stat = -2;
69
return
kv;
70
}
lib
gis
key_value3.c
Generated on Thu Sep 26 2013 09:48:03 for GRASS Programmer's Manual by
1.8.4