GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
Loading...
Searching...
No Matches
open_misc.c File Reference
#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"
Include dependency graph for open_misc.c:

Go to the source code of this file.

Functions

int G_open_new_misc (const char *dir, const char *element, const char *name)
 open a new database misc file
 
int G_open_old_misc (const char *dir, const char *element, const char *name, const char *mapset)
 open a database misc file for reading
 
int G_open_update_misc (const char *dir, const char *element, const char *name)
 open a database misc file for update
 
FILEG_fopen_new_misc (const char *dir, const char *element, const char *name)
 open a new database misc file
 
FILEG_fopen_old_misc (const char *dir, const char *element, const char *name, const char *mapset)
 open a database misc file for reading
 
FILEG_fopen_append_misc (const char *dir, const char *element, const char *name)
 
FILEG_fopen_modify_misc (const char *dir, const char *element, const char *name)
 

Function Documentation

◆ G_fopen_append_misc()

FILE * G_fopen_append_misc ( const char dir,
const char element,
const char name 
)

Definition at line 222 of file open_misc.c.

References _, err(), fdopen, G_mapset(), G_warning(), and name.

Referenced by I_fopen_group_file_append(), and I_fopen_subgroup_file_append().

◆ G_fopen_modify_misc()

FILE * G_fopen_modify_misc ( const char dir,
const char element,
const char name 
)

Definition at line 240 of file open_misc.c.

References _, err(), fdopen, G_mapset(), G_warning(), and name.

◆ G_fopen_new_misc()

FILE * G_fopen_new_misc ( const char dir,
const char element,
const char name 
)

open a new database misc file

The database file element under dir/name 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.

Parameters
dir
element
name
Returns
FILE *

Definition at line 183 of file open_misc.c.

References fdopen, G_mapset(), and name.

Referenced by I_fopen_group_file_new(), I_fopen_signature_file_new(), I_fopen_sigset_file_new(), I_fopen_subgroup_file_new(), Rast3d_write_cats(), Rast3d_write_colors(), Rast3d_write_history(), Rast__quant_export(), Rast_create_gdal_link(), and Rast_write_range().

◆ G_fopen_old_misc()

FILE * G_fopen_old_misc ( const char dir,
const char element,
const char name,
const char mapset 
)

open a database misc file for reading

The database file element under dir/name 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.

Parameters
dir
element
name
mapset
Returns
FILE *

Definition at line 210 of file open_misc.c.

References fdopen, and name.

Referenced by fopen_group_file_old(), fopen_subgroup_file_old(), I_fopen_signature_file_old(), I_fopen_sigset_file_old(), Rast3d_read_history(), Rast__quant_import(), Rast_get_gdal_link(), Rast_get_vrt(), Rast_is_reclassed_to(), Rast_read_histogram(), and Rast_read_range().

◆ G_open_new_misc()

int G_open_new_misc ( const char dir,
const char element,
const char name 
)

open a new database misc file

The database file element under dir/name 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.

Parameters
dir
element
name
Returns
int

Definition at line 111 of file open_misc.c.

References G_mapset(), and name.

Referenced by Rast_write_fp_range(), and Rast_write_rstats().

◆ G_open_old_misc()

int G_open_old_misc ( const char dir,
const char element,
const char name,
const char mapset 
)

open a database misc file for reading

The database file element under dir/name 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.

Parameters
dir
element
name
mapset
Returns
int

Definition at line 132 of file open_misc.c.

References name.

Referenced by Rast3d_open_cell_old_no_header(), Rast3d_read_range(), Rast__open_old(), Rast_read_fp_range(), and Rast_read_rstats().

◆ G_open_update_misc()

int G_open_update_misc ( const char dir,
const char element,
const char name 
)

open a database misc file for update

The database file element under dir/name 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.

Parameters
dir
element
name
Returns
int

Definition at line 152 of file open_misc.c.

References _, err(), G_mapset(), G_warning(), and name.