GRASS 8 Programmer's Manual 8.6.0dev(2026)-c83afef6d3
Loading...
Searching...
No Matches
sigfile.c
Go to the documentation of this file.
1/*!
2 \file lib/imagery/sigfile.c
3
4 \brief Imagery Library - Signature file functions (statistics for i.maxlik).
5
6 SPDX-FileCopyrightText: 2001-2008, 2013, 2021 GRASS Development Team
7 SPDX-License-Identifier: GPL-2.0-or-later
8
9 \author USA CERL
10 */
11
12#include <string.h>
13#include <grass/imagery.h>
14
15/*!
16 \brief Create signature file
17
18 Returns a pointer to FILE for writing signature file.
19 Use fclose on the pointer to close after use.
20
21 \param name signature filename
22
23 \return pointer to FILE
24 \return NULL on error
25 */
27{
28 char dir[GNAME_MAX];
29 FILE *fd;
30
31 /* create sig directory */
34 fd = G_fopen_new_misc(dir, "sig", name);
35
36 return fd;
37}
38
39/*!
40 \brief Open existing signature file
41
42 Use fully qualified names for signatures from other mapsets.
43
44 Returns a pointer to FILE with signature. Use fclose on the pointer
45 after use.
46
47 \param name signature filename
48
49 \return pointer to FILE
50 \return NULL on error
51 */
53{
55 char dir[GNAME_MAX];
56 FILE *fd;
57
60
62 fd = G_fopen_old_misc(dir, "sig", sig_name, sig_mapset);
63
64 return fd;
65}
#define NULL
Definition ccmath.h:32
int G_unqualified_name(const char *, const char *, char *, char *)
Returns unqualified map name (without @ mapset)
Definition nme_in_mps.c:132
FILE * G_fopen_old_misc(const char *, const char *, const char *, const char *)
open a database misc file for reading
Definition open_misc.c:210
FILE * G_fopen_new_misc(const char *, const char *, const char *)
open a new database misc file
Definition open_misc.c:183
const char * G_mapset(void)
Get current mapset name.
Definition gis/mapset.c:31
void I_make_signatures_dir(I_SIGFILE_TYPE)
Make signature dir.
void I_get_signatures_dir(char *, I_SIGFILE_TYPE)
Get signature directory.
#define GMAPSET_MAX
Definition gis.h:194
#define GNAME_MAX
Definition gis.h:193
@ I_SIGFILE_TYPE_SIG
Definition imagery.h:194
const char * name
Definition named_colr.c:6
#define strcpy
Definition parson.c:66
FILE * I_fopen_signature_file_old(const char *name)
Open existing signature file.
Definition sigfile.c:52
FILE * I_fopen_signature_file_new(const char *name)
Create signature file.
Definition sigfile.c:26