This is a short test example.
#include <iostream>
#include <iomanip>
#include <netcdf>
using namespace std;
using namespace netCDF;
using namespace netCDF::exceptions;
int main()
{
try
{
cout<<"Opening file \"firstFile.cdf\" with NcFile::replace"<<endl;
NcFile ncFile(
"firstFile.cdf",NcFile::replace);
cout<<left<<setw(50)<<"Testing addGroup(\"groupName\")";
NcGroup groupB(groupA.addGroup(
"groupB"));
NcGroup groupC(groupA.addGroup(
"groupC"));
cout <<left<<setw(50)<<
"Number of groups in the top-level group is" << ncFile.
getGroupCount() <<endl;
vector<string> stringArray(2);
stringArray[0] = "dim1";
stringArray[1] = "dim2";
}
{
cout << "unknown error"<<endl;
}
}