Thanks.  Here is a snippet of my code which appears to work....
//m_pConfig->getFilename() returns a std::string

H5File file(hdfFilename,H5F_ACC_TRUNC);
Group dataGroup = file.createGroup("/data");
StrType vlst(0, H5T_VARIABLE);
Attribute attrConfigFilename = dataGroup.createAttribute("configFilename",
vlst, DataSpace(H5S_SCALAR));
attrConfigFilename.write(vlst, m_pConfig->getFilename());

Isaac

On Mon, Jun 6, 2011 at 8:44 PM, Binh-Minh Ribler <[email protected]>wrote:

>  We don’t have such example yet, but you might find what you need in the
> C++ tests from our distribution: hdf5/c++/test/tvlstr.cpp, specific test is
> test_vlstring_attribute.
>
>
>
> Binh-Minh
>
> The HDF Group
>
>
>  ------------------------------
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Isaac Gerg
> *Sent:* Monday, June 06, 2011 8:23 PM
> *To:* HDF Users Discussion List
> *Subject:* Re: [Hdf-forum] Writing a std::string as an attribute to an
> HDFGroup
>
>
>
> C++
>
> On Jun 6, 2011 8:22 PM, "Binh-Minh Ribler" <[email protected]> wrote:
> > Hi Isaac,
> >
> >
> >
> > Are you trying to use HDF5 C library in your C++ code or are you trying
> to
> > use the HDF5 C++ API?
> >
> >
> >
> > Binh-Minh
> >
> >
> >
> > _____
> >
> > From: [email protected] [mailto:
> [email protected]]
> > On Behalf Of Isaac Gerg
> > Sent: Monday, June 06, 2011 5:39 PM
> > To: [email protected]
> > Subject: [Hdf-forum] Writing a std::string as an attribute to an HDF
> Group
> >
> >
> >
> > Hi everyone,
> >
> > I am wondering how to write a std::string as an attribute to an HDF5
> group.
> > I have found code for C and Java, but not for C++. I tried massaging the
> > code i found, but it throws an exception and im all out of ideas.
> >
> >
> >
> > Thanks,
> >
> > Isaac
> >
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
>
>
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to