NAME
MperrorExit - write error message to stderr and exits
SYNOPSIS
#include "csf.h"
void MperrorExit
(
const char *userString,
int exitCode
);
PARAMETERS
-
const char *userString
-
prefix string
-
int exitCode
-
exit code
DESCRIPTION
Mperror first writes the error message belonging to the current Merrno
value to stderr, prefixed by userString, separated by a semicolon.
Then Mperror exits by calling exit() with the given exit code.
RETURNS
NEVER RETURNS!
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)
MperrorExit(argv[1], 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);
}
SEE ALSO
Mperror
,
MstrError