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/xpagettofile.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 xpagettofile Context: xpa

Synopsis

Retrieve data from one or more XPA servers and write the results to a file.

Syntax

XPAGetToFile( XPA_Type xpaHdl, String_Type dest, String_Type cmd )
XPAGetToFile( XPA_Type xpaHdl, String_Type dest, String_Type cmd, fp )
XPAGetToFile( XPA_Type xpaHdl, String_Type dest, String_Type cmd, fp,
Integer_Type max_rec )
XPAGetToFile( XPA_Type xpaHdl, String_Type dest, String_Type cmd, fp,
Integer_Type max_rec, String_Type mode )

fp can be one of String_Type, File_Type, or FD_Type

Return values: (Array_Type names, Array_Type messages)

Description

The XPAGetToFile() function is similar to XPAGet() except that the returned data is stored in a file rather than as a S-Lang variable. This can be useful if a large amount of binary data is returned, in which case converting to a string format - as done by XPAGet() - is not very useful. The XPAGetB() function may also be of use in this situation.

The file handle to which the data is to be written is given by the fp variable. The default value (i.e. when it is not supplied) is to use stdout. If the argument is given then it can either be a string (in which case it represents the name of the file that will be created), a File_Type variable - as created by fopen() and popen() - or a FD_Type varible - as created by open().

The max_rec parameter allows you to limit the number of servers that are contacted, and the mode parameter is currently unused.

The return values contain the name and message sent back by each server that processed the command. The length of either array gives the number of servers contacted.

CHANGES IN CIAO 3.2

The return value of XPAGetToFile() has changed in CIAO 3.2. See the "Backwards Compatability" section below for a way of loading the module so that the old behavior is retained. The routine no longer returns an integer but two arrays.

Backwards Compatability

The old behavior can be retained by declaring the variable

_CIAO3_XPA_COMPAT_

in the Global namespace prior to the first loading of the module. As an example, after:

  if (0 != _featurep("xpa")) 
    error("The XPA module has already been loaded");
  public variable _CIAO3_XPA_COMPAT_;
  require("xpa");

then the CIAO 3.1 versions of the commands will be used. The first statement, fearuting the _featurep() function, is not necessary, but added as a precaution to check that the XPA module has not previously been loaded.

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.