NAME

Mopen - open an existing CSF file

SYNOPSIS

#include "csf.h"

MAP *Mopen
(
	const char *fileName,
	enum MOPEN_PERM mode
);

PARAMETERS

const char *fileName
file name
enum MOPEN_PERM mode
file permission

Possible values for an

enum MOPEN_PERM
are as follows:

DESCRIPTION

Mopen opens a CSF file. It allocates space for the MAP runtime-structure, reads the header file and performs test to determine if it is a CSF file. The MinMaxStatus is set to MM_KEEPTRACK if the min/max header fields are not MV or MM_WRONGVALUE if one of them contains a MV.

RETURNS

a pointer the MAP runtime structure if the file is successfully opened as a CSF file, NULL if not.

MERRNO

NOCORE BADACCESMODE OPENFAILED NOT_CSF BAD_VERSION

EXAMPLE

#include 
#include "csf.h"

/* test if files are CSF files
 * writing error messages to
 * stdout  
 */

void main(int argc, char *argv[] )
{
  MAP *map;
  int i;

  for(i=1; i < argc; i++)
    if ((map = Mopen(argv[1], M_READ)) == NULL)
    {
        printf("%s %s\n", argv[i], MstrError());
        ResetMerrno();
    }
    else
    {
        printf("%s is a CSF file\n",argv[i]);
        Mclose(map);
    }

  exit(0);
}

SEE ALSO

MopenPerm