NAME
RgetMaxVal - get maximum cell value
SYNOPSIS
#include "csf.h"
int RgetMaxVal
(
const MAP *map,
void *maxVal
);
PARAMETERS
-
const MAP *map
-
map handle
-
void *maxVal
-
write-only. Maximum value or missing value
DESCRIPTION
RgetMaxVal returns the value stored in
the header as the maximum value.
If the minMaxStatus is MM_WRONGVALUE
then a missing value is returned.
RETURNS
0 if argument maxVal is returned with a missing
value, nonzero if not.
EXAMPLE
#include
#include "csf.h"
/* write some features of
* a map to stdout
* use REAL8 (biggest type),
* works for all maps.
*/
void main(int argc, char *argv[] )
{
REAL8 min,max;
MAP *map;
if (argc != 2)
{
fprintf(stderr,"%s: no file specified\n",argv[0]);
exit(1);
}
map = Mopen(argv[1], M_READ);
if (map == NULL)
{
Mperror(argv[1]);
exit(1);
}
RuseAs(map, CR_REAL8);
/* min/max value */
printf("min/max (header): ");
if (RgetMinVal(map,&min))
printf("%g ",min);
else
printf("MV ");
if (RgetMaxVal(map,&max))
printf("%g \n",max);
else
printf("MV \n");
Mclose(map);
exit(0);
}