[netcdfgroup] c++ NcFile assignment doesn't work

Not too far back I noticed that I could not use an NcFile object as a class
member, which I asked about here:
http://netcdf-group.1586084.n2.nabble.com/NcFile-as-class-member-td7575625.html#a7575628

I never resolved that issue, but I was playing around with it again today.
I wrote a very simple bit of test code, and realized the problem is
actually much more fundamental than the one I originally asked about.
Assignment to an empty NcFile variable does not work anywhere.

For example:

#include <netcdf>

int main(int argc, char *argv[])
{
    using namespace netCDF;
    using namespace netCDF::exceptions;

    NcFile foo;
    foo = NcFile("blah.nc", NcFile::replace);

    double baz = 1.0;
    foo.putAtt("bar", ncDouble, size_t(1), &baz);

    return 0;
}

fails at the putAtt line with the same netCDF::exceptions::NcBadId
exception I saw in the older question. The exception points to ncGroup.cpp
line 791, which is just the definition of putAtt.

Anyone have any insight? Thanks.
  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: