read_stats.c 356 B

123456789101112131415161718
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <grass/gis.h>
  4. #include <grass/glocale.h>
  5. int read_stats(FILE * fd, long *cat1, long *cat2, double *value)
  6. {
  7. char buf[1024];
  8. if (fgets(buf, sizeof buf, fd) == NULL)
  9. return 0;
  10. if (sscanf(buf, "%ld %ld %lf", cat1, cat2, value) != 3)
  11. G_fatal_error(_("reading r.stats output"));
  12. return 1;
  13. }