[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20010123: nc-3.5 Fortran 90: nf90_get_var() on 2D character variable
- Subject: 20010123: nc-3.5 Fortran 90: nf90_get_var() on 2D character variable
- Date: Tue, 23 Jan 2001 16:29:53 -0700
David,
>Date: Tue, 23 Jan 2001 15:28:54 -0700 (MST)
>From: Robert Pincus <address@hidden>
>Organization: ?
>To: "Bennett, David A" <address@hidden>
>Subject: RE: 20010123: nc-3.5 Fortran 90: nf90_get_var() on 2D character v
>ariable
>Keywords: 200101162001.f0GK1ue07435
The above message contained the following:
> I don't remember how the C interface differs from the Fortran 90 interface
> well enough off the top of my head to know if strings are treated
> differently. If the C interface uses null characters to delineate the end
> of strings, though, you're in trouble.
In the C API, strings are treated as fixed-length character arrys with
no trailing NUL (0) character. In fact, the C API really doesn't have
the concept of "strings" at all -- just arrays of character values. If
the data is written with a trailing NUL, then the read-in array will
contain the NUL (assuming a sufficient number of characters was read);
otherwise, it won't.
Regards,
Steve Emmerson <http://www.unidata.ucar.edu>