C++ Witch:
I found this in a google search for how to copy a C struct to a C++ class.
This seems closer to what I need to know than anything I have found.
Explaination:
I have a library (ancio, from PNNL, written by Jason Christy) that will read a netCDF file into a C struct. It is general code that will read any netCDF file into a C struct named data. I do not understand C well enought to only copy those parts (of the program and the header file).
I want to then copy that C struct, include the contents, into a C++ class. I want to do that so that I can output the C struct contents into a ROOT Ttree (from CERN). The Ttree is written to accept C structs, but the over head of offsets, etc is automatically determine from a C++ class.
I have compiled the ancio library using C++ (very few modifications were required, mostly () , and moving a definition). So using C++ I want to include the headers I need, that is ROOT includes for creating Ttrees, the netCDF header, the ancio.h, and using the small amount of C code that I have been able to write (using a few printf(some pointer to the C data struct) convincing myself that I have opened the netCDF file, and read its contents into the data struct.
Code:
It will be extern "C" {
my code to open the netCDF file, create *dataP, and then
} //end extern C
C++ code here to create, open and write to a Ttree //examples abound on the internet
the copy *dataP to class data
then convert netCDF storage types to Ttree types
then close the file.
So that is what I want to do. I have read every available C++ book I can find at Borders
and searched the internet, and nothing seems to have the answer.
You seem to be closer to it here than I have been.
Thanking you in advance.