Re: ncdigest V1 #345

At 21:25 9.7.1996 -0600, you wrote:
>
>ncdigest                   Tuesday, 9 July 1996       Volume 01 : Number 345
>
>Today's Topics:
>
>Tim Weilkiens - Problems with Strings
>William Weibel  - Re: Problems with Strings
>----------------------------------------------------------------------
>----------------------------------------------------------------------
>
>From: Tim.Weilkiens@xxxxxxxxxxxxxxx  (Tim Weilkiens)
>Date: Tue, 09 Jul 1996 14:02:32 EDT
>Subject: Problems with Strings
>
>Hello,
>
>I have the following problem:
>
>My netCDF file structure:
>
>..
>dim2 = 2;
>dim30 = 30;
>..
>char name(dim2, dim30);
>..
>
>I read the data with:
>
>long start[MAX_DIMS] = {0, 0};
>long count[MAX_DIMS] = {2, 30};
>ncvarget(cdfid, start, count, &value);
>
>After this operation value contains the data in this way: 
><string1><string2>, e.g. JohnPaul
>
>So, how can I know which part is the first string and which is the second.
>There is no delimiter set, and I only know that the max. string length is 30.
>
>
>Thanks for any helpful hints,
>
>    Tim

I have seen this done by using a second variable (vector) of indexes into
the string vector.  This index vector is first read, and then used to
extract the strings correctly from the string array.

Hope this helps,
   Markus
Markus Gudmundsson, Computer Engineer        Strengur ltd, Iceland
markus@xxxxxxxxxxx                           Phone: +354 550-9000 
                      Beeper: +354 846-0352  Fax:   +354 550-9010


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