[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file descriptors...



> From: Leigh Angus <address@hidden>
> Subject: file descriptors...
> To: address@hidden

Hi Leigh,

> My name is Leigh Angus and I'm a meteorologist/programmer with the
> Cooperative Institute for Research in the Atmosphere (CIRA) working
> with the NOAA Forecast System Lab here in Boulder.  I
> have a quick question for you regarding the C++ implementation of
> netCDF.
> 
> 
> Can I retrieve the file descriptor of an open netCDF data file that
> was opened as a result of my instantiating an "NcFile" class.  I have
> given the constructor the name of the file I want to open (path) and
> I've set the FileMode to be "NcFile::Write".  Can I somehow get the
> open netCDF file's integer file descriptor using some member function
> (or otherwise) using the C++ interface?

Yes, the NcFile::id() member function actually returns the file
descriptor, if you are using netCDF version 3:


    int id( void ) const;       // id used by C interface

In netCDF version 2, the id was merely a small integer that had no
relation to the file descriptor, so you couldn't get access to the
actual file descriptor in either the C or C++ interface.

--Russ