Skip to the navigation links
Last modified: December 2009

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/paramopen.html
AHELP for CIAO 4.2

paramopen

Context: paramio

Synopsis

Open a parameter file.

Syntax

Param_File_Type paramopen( paramfilename )
Param_File_Type paramopen( paramfilename, mode )
Param_File_Type paramopen( paramfilename, mode, arglist )
Param_File_Type paramopen( NULL, mode, arglist )

Description

Open a parameter file, returning a file pointer which can be used with the other paramio functions. If you are going to be accessing the same parameter file multiple times then it is more efficient to use the Param_File_Type variable returned by paramopen() in the function calls rather than to repeatedly use the name of the tool.

The mode defaults to "r" and should be one of the "IRAF-compatible" paramater-interface access modes (eg "r", "rw", "rH", etc).

If the arglist is supplied then it should be a String_Type array containing parameter settings that over-ride those given in the parameter file. The first element of the array should contain the name of the tool (i.e. the name used to access the parameter file), and - as of CIAO 3.2 - the first argument can be set to NULL when used in this form. If used from slsh then using __argv for arglist will allow you to process the command-line arguments of the script through the parameter library. See "ahelp paramio" for an example of how this can be used to add parameter handling to a S-Lang script.

Error handling

As with all the paramio routines, the PF_Errno variable is set to 0 on success, or on error it is set to one of the error codes listed in the paramio documentation.

Example

require("paramio");
variable fp = paramopen("dmextract");
vmessage( "The opt parameter=%s", pget(fp,"opt") );
paramclose( fp );

Open the parameter file for the dmextract tool. As no mode is given it defaults to "r" - ie read-only. The variable returned by paramopen() is then used in a call to pget() to find out the value of the "opt" parameter, before the parameter file is closed via the call to paramclose().

Bugs

See the bugs page for the paramio module on the CIAO website for an up-to-date listing of known bugs.

See Also

concept
parameter
modules
paramio
paramio
paccess, paramclose, pget, pgets, plist_names, pquery, pset, punlearn
tools
dmhistory, dmkeypar, dmmakepar, dmreadpar, paccess, pdump, pget, pline, plist, pquery, pset, punlearn

Last modified: December 2009