GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
GIS Library - Open file functions. More...
#include <grass/config.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "gis_local_proto.h"
Go to the source code of this file.
Functions | |
int | G_open_new (const char *element, const char *name) |
Open a new database file. More... | |
int | G_open_old (const char *element, const char *name, const char *mapset) |
Open a database file for reading. More... | |
int | G_open_update (const char *element, const char *name) |
Open a database file for update. More... | |
FILE * | G_fopen_new (const char *element, const char *name) |
Open a new database file. More... | |
FILE * | G_fopen_old (const char *element, const char *name, const char *mapset) |
Open a database file for reading. More... | |
FILE * | G_fopen_append (const char *element, const char *name) |
Open a database file for update (append mode) More... | |
FILE * | G_fopen_modify (const char *element, const char *name) |
Open a database file for update (r+ mode) More... | |
GIS Library - Open file functions.
(C) 1999-2015 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.
Definition in file gis/open.c.
FILE* G_fopen_append | ( | const char * | element, |
const char * | name | ||
) |
Open a database file for update (append mode)
The database file name under the element in the current mapset is opened for for writing. The UNIX fopen() routine, with "a" append mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file descriptor from the fopen() is returned.
element | database element name |
name | map file name |
Definition at line 278 of file gis/open.c.
FILE* G_fopen_modify | ( | const char * | element, |
const char * | name | ||
) |
Open a database file for update (r+ mode)
The database file name under the element in the current mapset is opened for for writing. The UNIX fopen() routine, with "r+" append mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file descriptor from the fopen() is returned.
element | database element name |
name | map file name |
Definition at line 306 of file gis/open.c.
Referenced by V1_open_new_nat(), and V1_open_old_nat().
FILE* G_fopen_new | ( | const char * | element, |
const char * | name | ||
) |
Open a new database file.
The database file name under the element in the current mapset is created and opened for writing (but not reading). The UNIX fopen() routine, with "w" write mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the fopen() is returned.
element | database element name |
name | map file name |
Definition at line 219 of file gis/open.c.
Referenced by G_put_3dview(), I_put_group(), Rast__quant_export(), Rast_put_cellhd(), Rast_write_history(), V1_open_new_nat(), Vect__write_head(), Vect_save_frmt(), Vect_save_topo(), and Vect_write_dblinks().
FILE* G_fopen_old | ( | const char * | element, |
const char * | name, | ||
const char * | mapset | ||
) |
Open a database file for reading.
The database file name under the element in the specified mapset is opened for reading (but not for writing). The UNIX fopen() routine, with "r" read mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file descriptor from the fopen() is returned.
element | database element name |
name | map file name |
mapset | mapset name containing map name |
Definition at line 251 of file gis/open.c.
Referenced by I_get_group(), Rast__quant_import(), Rast_get_cell_title(), Rast_get_cellhd(), Rast_read_history(), V1_open_old_nat(), Vect__read_head(), Vect_cidx_open(), Vect_close(), Vect_open_fidx(), and Vect_open_topo().
int G_open_new | ( | const char * | element, |
const char * | name | ||
) |
Open a new database file.
Creates name in the current mapset and opens it for write only.
The database file name under the element in the current mapset is created and opened for writing (but not reading). The UNIX open() routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the open() is returned.
element | database element name |
name | map file name |
Definition at line 149 of file gis/open.c.
int G_open_old | ( | const char * | element, |
const char * | name, | ||
const char * | mapset | ||
) |
Open a database file for reading.
The database file name under the element in the specified mapset is opened for reading (but not for writing). The UNIX open() routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file descriptor from the open() is returned.
element | database element name |
name | map file name |
mapset | mapset containing map name |
Definition at line 170 of file gis/open.c.
Referenced by Rast__open_old().
int G_open_update | ( | const char * | element, |
const char * | name | ||
) |
Open a database file for update.
The database file name under the element in the current mapset is opened for reading and writing. The UNIX open() routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the open() is returned.
element | database element name |
name | map file name |
Definition at line 191 of file gis/open.c.