### gsdGet1x

Get an array from a GSD file

#### Description:

This routine returns the value of a scalar GSD item. The item must be specified by the file desciptor, item descriptor array, data array and item number.
 $<$t$>$ $<$type$>$ Fortran GSD b char byte byte l char logical$\ast$1 logical w short integer$\ast$2 word i int integer$\ast$4 integer r float real$\ast$4 real d double real$\ast$8 double c char[16] character$\ast$16 char

This routine does not convert between types. If the type of the GSD item does not match the type of the routine, then it returns with an error.

It is possible to get only part of the array. Although the part can be specified in terms of an N-dimensional array, this routine does not take a proper N-D section of the array. The caller can specify the start pixel in N dimensions and the end pixel in N dimensions. These two pixels will be converted to memory locations and all memory between the two is returned. This emulates the old GSD library. It is useful really only for parts of 1-D arrays, parts of rows, or single pixels.

#### Invocation

int gsdGet1{blwird}( void $\ast$file_dsc, void $\ast$item_dsc, char $\ast$data_ptr, int itemno, int ndims, int $\ast$dimvals, int $\ast$start, int $\ast$end, $<$type$>$ $\ast$values, int $\ast$actvals );

#### Arguments

##### void $\ast$file_dsc (Given)
The GSD file descriptor.
##### void $\ast$item_dsc (Given)
The array of GSD item descriptors related to the GSD file.
##### char $\ast$data_ptr (Given)
The buffer with all the data from the GSD file.
##### int itemno (Given)
The number of the item in the GSD file.
##### int ndims (Given)
The dimensionality the calling routine uses to specify the start and end elements.
##### int $\ast$dimvals (Given)
The array of ndims dimensions (array sizes along each axis).
##### int $\ast$start (Given)
The array indices for the first element.
##### int $\ast$end
The array indices for the last element.
##### $<$type$>$$\ast$value (Returned)
The data values. The calling routine must make sure that sufficient memory is provided. Thus it must find out the data type and array size before calling this routine. If the data type is character, then the routine returns a byte buffer with all strings concatenated. There are no string terminators in the buffer and there is none at the end. Each string is 16 byte long and immediately followed by the next string.
##### int $\ast$actvals (Returned)
The number of array values returned. This saves the caller to work out how many array elements correspond to start and end given the dimvals.

#### Returned Value

##### int gsdGet1$<$t$>$();
Status.
• [1:] Failure to read the item values.

• [2:] Numbered item cannot be found.

• [4:] Given start and end are inconsistent.

• [0:] Otherwise.

#### Prototype

available via #include "gsd.h"