GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
GIS Library - Temporary file functions. More...
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <grass/gis.h>
Go to the source code of this file.
Functions | |
char * | G_tempfile (void) |
Returns a temporary file name. More... | |
char * | G__tempfile (int pid) |
Create tempfile from process id. More... | |
int | G__temp_element (char *element) |
Populates element with a path string. More... | |
GIS Library - Temporary file functions.
(C) 2001-2008 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 tempfile.c.
int G__temp_element | ( | char * | element | ) |
Populates element with a path string.
[in,out] | element |
Definition at line 90 of file tempfile.c.
References G__machine_name(), G__make_mapset_element(), and NULL.
Referenced by G__tempfile(), and main().
char* G__tempfile | ( | int | pid | ) |
Create tempfile from process id.
See G_tempfile().
[in] | pid |
Definition at line 62 of file tempfile.c.
References G__file_name(), G__temp_element(), G_mapset(), G_store(), render::name, sprintf(), and stat.
Referenced by G_tempfile().
char* G_tempfile | ( | void | ) |
Returns a temporary file name.
This routine returns a pointer to a string containing a unique temporary file name that can be used as a temporary file within the module. Successive calls to G_tempfile() will generate new names. Only the file name is generated. The file itself is not created. To create the file, the module must use standard UNIX functions which create and open files, e.g., creat() or fopen().
Successive calls will generate different names the names are of the form pid.n where pid is the programs process id number and n is a unique identifier.
Note: It is recommended to unlink() (remove) the temp file on exit/error. Only if GRASS is left with 'exit', the GIS mapset manangement will clean up the temp directory (ETC/clean_temp).
Definition at line 47 of file tempfile.c.
References G__tempfile().
Referenced by D_popup(), G3d_openCellNew(), G_ask_datum_name(), G_ask_ellipse_name(), G_ask_proj_name(), G_put_cell_title(), GPJ_ask_datum_params(), I_list_groups(), I_list_subgroups(), and Vect_delete().