c_lsread - Reads one record from a label services file

SYNTAX

#include "las.h"
#include "vll.h"
FUNCTION c_lsread (fd, key, clen, dlen, cbuf, dbuf, dtype)

     long               *fd;
     char               *key;
     long               *clen;
     long               *dlen;
     char               *cbuf;
     unsigned char      *dbuf;
     char               *dtype;

PARAMETERS

fd (input, integer)

File descriptor of an opened label services file. The file descriptor is set by c_lsopen() and should not be altered.

key (input/output, character, length (1:KEYL))

Key of the record to be read. Spaces may be embedded in the key; however, right justified spaces are ignored. If the key is NULL or a blank, the current record within the file is read. If a value is specified for the key, the first record found with the same key is read. The key value of the record read is returned in this parameter.

clen (input/output, integer)

The number of bytes in the character portion of the record. On input clen length of cbuf. The actual number of bytes in the character portion of the record, plus 1 (one) for the null character, is returned in this parameter.

dlen (input/output, integer)

The number of bytes in the data portion of the record. On input, dlen should be set to the length of dbuf. The actual number of bytes in the data portion of the record is returned in this parameter.

cbuf (output, character, length(clen))

Character buffer to read the character portion of the record into.

dbuf (output, unsigned char, length(dlen))

Data buffer to read the data portion of the record into.

dtype (output, character, length(2))

Data type of the data portion of the record. Valid data types are:

     = B :     Byte data
     = I2:     Integer*2 data
     = I4:     Integer*4 data
     = R4:     Real*4 data
     = R8:     Real*8 data

DESCRIPTION

The c_lsread() call is used to read one record from the label services file. The c_lsread() function requires the file to be opened with read access.

A key value of "DELETED" is invalid.

A return value of E_SMAL (-3) implies the data and/or character buffers are too small to read the data into. The file pointer is returned to the beginning of the record, and the actual buffer lengths are returned in parameters clen and dlen. The calling program may reallocate larger buffers and call c_lsread() again to read the specified record.

RETURN VALUE

c_lsread() returns

     E_SUCC (0)  --> successful completion 
     E_FAIL (-1) --> operation failed
     E_EOF  (-2) --> end of file detected  (no message)
     E_SMAL (-3) --> operation failed, buffers too small (no message)