open_files.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*****************************************************************************/
  2. /*** ***/
  3. /*** open_files() ***/
  4. /*** Opens input and output raster maps. ***/
  5. /*** Jo Wood, Project ASSIST, 24th January 1993 ***/
  6. /*** ***/
  7. /*****************************************************************************/
  8. #include <grass/gis.h>
  9. #include <grass/glocale.h>
  10. #include "param.h"
  11. void open_files(void)
  12. {
  13. /* Open existing file and set the input file descriptor. */
  14. if ((fd_in = G_open_cell_old(rast_in_name, mapset_in)) < 0)
  15. G_fatal_error(_("Cannot open raster map <%s>"), rast_in_name);
  16. /* Open new file and set the output file descriptor. */
  17. if (mparam != FEATURE)
  18. {
  19. if ((fd_out = G_open_raster_new(rast_out_name, DCELL_TYPE)) < 0)
  20. G_fatal_error(_("Cannot create raster map <%s>"), rast_out_name);
  21. } else {
  22. if ((fd_out = G_open_raster_new(rast_out_name, CELL_TYPE)) < 0)
  23. G_fatal_error(_("Cannot create raster map <%s>"), rast_out_name);
  24. }
  25. return;
  26. }