Subject: cfitsio - not opening FITS file

From: James Adams <jadams at ucar.edu>
Date: Mon, 18 Nov 1996 17:28:50 -0700

Hello,

	I am attempting to use cfitsio to read FITS images and convert them to
our in-house image format for processing.  I have coded and compiled a
program which opens a FITS file and then reads its image data.  I am
running into trouble as soon as I attempt to open the FITS file (which
has correct permissions set).  The status returned by the
fits_open_file() routine is indecipherable ( status == 260934144 ) and
produces no error message on the error message stack, so I'm clueless as
to where the problem lies.

	I am running on an SGI, IRIX 5.3.  I am compiling using SGI's native
C++ compiler (is the problem that I am using these routines with C++
instead of plain C ?)

	My sample code (which compiles but doesn't work as advertised)

//---------------------------------------------------------------------
Boolean
nrifFrame::readFromFITSFile (const char *fits_name)
{
    // local variables
    fitsfile *fptr;
    int status;
    
    // open the FITS file
    if (fits_open_file (&fptr,
			fits_name,
			READONLY,
			&status))
    {
	return Error ("Unable to open FITS file");
    }
			
  ........

//---------------------------------------------------------------------

	Where would I start to look for the problem ?  As I said the error
message and status information returned by the cfitsio routine is
useless, so I am looking for any other methods of debugging the problem
(or hopefully someone reading this will have seen this before and can
suggest a workaround).  Any assistance you can provide will be greatly
appreciated !

Kind regards,
James
-- 
---------------------------------------------------------------------------
James Adams                               Email: jadams at ucar.edu
National Center for Atmospheric Research  Phone: (303) 497-1356
Boulder, Colorado                         Fax:   (303) 497-1348

	WWW:  http://www.cgd.ucar.edu/ccr/jadams/home.html

---

From: "Bruce O'Neel" <oneel at arupa.gsfc.nasa.gov>
Date: Tue, 26 Nov 96 14:32:47 -0500

>C++ compiler (is the problem that I am using these routines with C++

Hi,
  Clive Page is correct.  Try changing your code to

    int status = 0;
//             ^^^
// That was the change
    
    // open the FITS file
			
  ........

should fix your problem.

Bruce

Aspiring to be the junior vice president of water cooler refilling 
[partially from Dan Meriwether]