GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72996
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
key_value2.c File Reference

Read/write Key_Value from/to file. More...

#include <grass/gis.h>
Include dependency graph for key_value2.c:

Go to the source code of this file.

Functions

int G_fwrite_key_value (FILE *fd, const struct Key_Value *kv)
 Write key/value pairs to file. More...
 
struct Key_ValueG_fread_key_value (FILE *fd)
 Read key/values pairs from file. More...
 

Detailed Description

Read/write Key_Value from/to file.

(C) 2001-2008, 2012 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
CERL

Definition in file key_value2.c.

Function Documentation

struct Key_Value* G_fread_key_value ( FILE *  fd)

Read key/values pairs from file.

Allocated memory must be freed G_free_key_value().

Parameters
fdfile to read key/values from
Returns
pointer to allocated Key_Value structure
NULL on error

Definition at line 49 of file key_value2.c.

References G_create_key_value(), G_getl2(), G_set_key_value(), G_strip(), Key_Value::key, NULL, and Key_Value::value.

Referenced by G_read_key_value_file(), Rast_get_gdal_link(), and Vect_close().

int G_fwrite_key_value ( FILE *  fd,
const struct Key_Value kv 
)

Write key/value pairs to file.

Parameters
[in,out]fdfile to write to
kvpointer Key_Value structure
Returns
0 success
-1 error writing

Definition at line 25 of file key_value2.c.

References err(), Key_Value::key, Key_Value::nitems, and Key_Value::value.

Referenced by G_write_key_value_file(), and Rast_create_gdal_link().