About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/paramopen.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 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().

CHANGES IN CIAO 3.2

When the three-argument form of paramopen() is used, the parameter file name is taken from the first element of the arglist array. This means that:

  • The first argument of paramopen() - i.e. paramfilename - can be set to NULL in this case.
  • Parameter files specified on the command-line using the "@@" syntax will now be correctly handled (for slsh scripts which set arglist to be equal to __argv).

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.