GRASS Programmer's Manual  6.4.3(2013)-r
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
put_cellhd.c
Go to the documentation of this file.
1 
2 /**********************************************************************
3  *
4  * G_put_cellhd (name, cellhd)
5  * char *name name of map
6  * struct Cell_head *cellhd structure holding cell header info
7  *
8  * Writes the cell file header information associated with map layer "map"
9  * into current mapset from the structure "cellhd".
10  *
11  * returns: 0 if successful
12  * -1 on fail
13  *
14  ***********************************************************************/
15 
16 #include <grass/gis.h>
17 #include <grass/glocale.h>
18 
19 int G_put_cellhd(const char *name, struct Cell_head *cellhd)
20 {
21  FILE *fd;
22 
23  if (!(fd = G_fopen_new("cellhd", name))) {
24  char buf[1024];
25 
26  sprintf(buf, _("Unable to create header file for [%s]"), name);
27  G_warning(buf);
28  return -1;
29  }
30 
31  G__write_Cell_head(fd, cellhd, 1);
32  fclose(fd);
33 
34  return 0;
35 }