/* WRITEMAP - write a test area into a big image */
#include <stdio.h>
#include <errno.h>
#include "bigio.h"
int main ( int argc, char **argv )
{
char mapname[132]; /* name of directory to hold bigimage */
int bd; /* bigimage descriptor */
int status; /* status */
short values[200]; /* values written to the bigimage */
int j; /* loop counter */
char errmsg[80]; /* error message */
/* Initialise the array of values to be put */
for ( j=0; j<200; j++ )
{
values[j] = (short)j/(short)10;
}
/* Extract the mapname, which is the name of the directory to hold the
bigimage */
if ( argc == 2 )
{
strcpy ( mapname, argv[1] );
status = 0;
/* Open the bigimage and overwrite a 2-D rectangular area of it */
bigio_open ( mapname, "update", &bd, &status );
if ( status != 0 )
{
printf ( "failed to open map\n" );
bigio_errtran ( 80, errmsg, &status );
printf ( "%s\n", errmsg );
}
else
{
bigio_putmap ( bd, 5, 5, 14, 24, (char *)values, &status );
if ( status != 0 )
{
printf ( "failed to write map\n" );
bigio_errtran ( 80, errmsg, &status );
perror ( errmsg );
}
}
}
else
{
printf ( "writemap: usage:- writemap mapname\n" );
}
return 0;
}