NAME
RgetCell - read one cell from a CSF raster file
SYNOPSIS
#include "csf.h"
size_t RgetCell
(
MAP *map,
size_t rowNr,
size_t colNr,
void *cellValue
);
PARAMETERS
-
MAP *map
-
map handle
-
size_t rowNr
-
row number of cell
-
size_t colNr
-
column number of cell
-
void *cellValue
-
write-only. buffer, large enough to hold
the value of the cell in the file and app
cell representation
DESCRIPTION
RgetCell reads one cell value from a
file.
RETURNS
1 if cell is successfully read,
0 if not
EXAMPLE
#include
#include "csf.h"
/* a simple csf to stdout
* program, with minimal
* checking
*/
void main(int argc, char *argv[] )
{
REAL8 cellValue;
MAP *map;
size_t r,c;
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);
for(r=0; r < RgetNrRows(map); r++)
{
for(c=0; c < RgetNrCols(map); c++)
{
RgetCell(map,r,c,&cellValue);
printf("%g ",(double)cellValue);
}
printf("\n");
}
Mclose(map);
exit(0);
}