> 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.
In the C language, strings are terminated with ASCII NUL (ASCII value 0).
NULs are invisible, so it's possible that the contents of value could be
John\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0Paul\0\0\0...
If this guess is correct, then e.g. strcpy(value[0],string1)
and strcpy(value[1],string2) should copy John and Paul separately.
Bill
William Weibel weibel@xxxxxxxxxxxxxx
UCLA Department of Atmospheric Sciences Tel. (310)206-4441 \\\\/
Los Angeles, CA 90095-1565 Fax (310)206-5219 O-O
U.S.A. |
-
'Why,' said the Dodo, 'the best way to explain it is to do it.'
Alice's Adventures in Wonderland
|||| | | | | | | | | | | | | | | | | | | | | | | ||||