Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

Re: Should NetCDF character attributes be null-terminated

  • To: "Mark Hadfield" <m.hadfield@xxxxxxxxxxx>
  • Subject: Re: Should NetCDF character attributes be null-terminated
  • From: Jim Secan <jim@xxxxxxxxxxx>
  • Date: Fri, 03 Aug 2001 07:52:39 -0700
At 12:24 PM 08/03/01 +1200, Mark Hadfield wrote:
>Hello all
>
>I started writing the following as a bug report to the IDL people, but now
>I'm not so sure. Perhaps the netCDF experts could give a ruling on this
>matter:
>
>    When an application writes text data to a netCDF file attribute,
>    should it (may it, must it) terminate the data with a null character?

Mark...

I've had to deal with this from Fortran programs as well, and I'd certainly
like to see it "fixed."  I hacked around this by writing a short utility
routine that checks a string to see if it terminates with a '\0' character.
 If so, the null is replaced by a space.  An engineering approach, perhaps,
but it cured what ailed me.

Jim
*---------------------*-------------------------------*
| Jim Secan           | Northwest Research Assoc, Inc |
| (jim@xxxxxxxxxxx)   | 2455 E. Speedway, Suite 203   |
| (520) 319-7773      | Tucson, Arizona 85719         |
|    Space Weather Info: http://www.nwra-az.com/      |
*---------------------*-------------------------------*

  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: