put_cellhd.c 870 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**********************************************************************
  2. *
  3. * G_put_cellhd (name, cellhd)
  4. * char *name name of map
  5. * struct Cell_head *cellhd structure holding cell header info
  6. *
  7. * Writes the cell file header information associated with map layer "map"
  8. * into current mapset from the structure "cellhd".
  9. *
  10. * returns: 0 if successful
  11. * -1 on fail
  12. *
  13. ***********************************************************************/
  14. #include <grass/gis.h>
  15. #include <grass/glocale.h>
  16. int G_put_cellhd(const char *name, struct Cell_head *cellhd)
  17. {
  18. FILE *fd;
  19. if (!(fd = G_fopen_new("cellhd", name))) {
  20. char buf[1024];
  21. sprintf(buf, _("Unable to create header file for [%s]"), name);
  22. G_warning(buf);
  23. return -1;
  24. }
  25. G__write_Cell_head(fd, cellhd, 1);
  26. fclose(fd);
  27. return 0;
  28. }