NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

Re: Should NetCDF character attributes be null-terminated

Mark,

In my opinion, the best thing to do is to write code that is very
conservative about what it writes into a netCDF dataset and very
liberal about what it reads. In this specific case, I wouldn't write
the terminating NUL character. On reading, however, I would check for a
terminating NUL (regardless of language) and do the appropriate thing
for the language (ensure either its presence or absence).

Nothing in the netCDF library depends on a terminating NUL.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>