Reference

hxsetdir(3hdf)

intn HXsetdir(const char *dir)

dir
IN: directory for locating an external file

Purpose

Set the directory variable for locating an external file

Return value

Return SUCCEED if no error, else FAIL.

Description

HXsetdir sets the directory variable for locating an external file according to dir which may contain multiple directories separated by verticle bars (e.g., "dir1|dir2"). The content of dir is copied into private memory of the HDF library. If dir is NULL, the directory variable is unset. If HXsetdir encounters any error, the directory variable is not changed.

By default, the HDF library locates the external file just like the open(2) call. It also searches for the external file in the directories specified by the user environment variable $HDFEXTDIR (if defined) and the directory variable set by HXsetdir(). The searching precedence is directory variable (if set), then $HDXEXTDIR, then just like open().

The searching differs if the external filename is an absolute pathname, i.e., starting with a slash (/). HDF will try open() first. If open() fails and if $HDFEXTDIR is defined or the directory variable is set via HXsetdir(), HDF will remove all directory components of the absolute pathname (e.g., /usr/groupA/projectB/Data001 becomes Data001) and search for that filename with the strategy noted in the above paragraph.

Examples

Assume the following files exist,

	/DataVault/ProjectB/datadir/data001.clean
	Mydata/datadir/data001
and
	HXsetdir("/DataVault/ProjectB")
	$HDFEXTDIR is "Mydata|Mydata/datadir"

For each external filename on the left, HDF will open the file on the right,

External FilenameHDF opens file
datadir/data001Mydata/datadir/data001
datadir/data001.clean/DataVault/ProjectB/datadir/data001.clean
/usr/groupA/ProjectB/data001Mydata/datadir/data001
FORTRAN

integer function hxsdir(dir)
character*(*) dir