[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #KJU-947913]: nf90_get_att (nf_get_att_text): null characters



Hi Ryo,

It seems to me this bug could be fixed with a one-line addition to 
f90/netcdf_attributes.f90, setting values to a blank string before calling 
nf_get_att_text:

  function nf90_get_att_text(ncid, varid, name, values)
    integer,                          intent( in) :: ncid, varid
    character(len = *),               intent( in) :: name
    character(len = *),               intent(out) :: values
    integer                                       :: nf90_get_att_text

    values = ' '  !! make sure result will be blank padded
    nf90_get_att_text = nf_get_att_text(ncid, varid, name, values)
  end function nf90_get_att_text

Of course, this would not fix the problem for Fortran-77 calls to 
nf_get_att_text, but I'm unclear whether Fortran-77 programs make the same 
assumption about blank-padding char arrays.  If so, fixing the problem in the 
Fortran-77 wrappers instead is more difficult.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: KJU-947913
Department: Support netCDF
Priority: High
Status: Closed