This routine provides a simple mechanism for obtaining the pointer to a data or parameter file. It is called with two character strings. One of these is the name of an environment variable, for example GRASP_DATAPATH or GRASP_PARAMETERS. The second argument is the ``tail end" of a path name. The routine then constructs a path name whose leading component is determined by the environment variable and whose tail end is determined by the short path name. grasp_open() opens the file (printing useful error messages if this is problematic) and returns a pointer to the file.
The arguments are:
r or rb open file for reading
w or wb truncate to zero length or create file for
writing
a or ab append; open or create file for writing at
end-of-file
r+ or rb+ or r+b open file for update (reading and writing)
w+ or wb+ or w+b truncate to zero length or create file for
update
a+ or ab+ or a+b append; open or create file for update,
writing at end-of-file
As a simple example, if the environment variable GRASP_PARAMETERS
is set to
/usr/local/data/14nov94.2
and one calls
grasp_open("GRASP_PARAMETERS","channel.0","r")
then the routine opens the file
/usr/local/data/14nov94.2/channel.0
for reading and returns a pointer to it.