c_read - Reads an input file and converts data to the local endian

SYNTAX

#include "lasfileio.h"

ssize_t c_read 
(
     int fd,
     void *buf,
     size_t count,
     size_t size
)

PARAMETERS

fd (input, int /* file descriptor*/)

File descriptor of the file to read. This file should be opened by the standard unix open call.

buf (input, VOID *)

Pointer to a buffer for the data read from the file. The data is converted from big endian byte order to the local byte order.

count (input, size_t)

Specifies the number of bytes to read from the file.

size (input, size_t)

Specifies the size, in bytes, of each element read from the file. This is limited to be 1, 2, 4, or 8 bytes to match the sizes of standard data types. The count parameter must be an even multiple of the size parameter.

DESCRIPTION

All data files for LAS are written using big endian byte order. This is the byte order used by Mips, Sparc, and Motorola processors. The c_read() routine is the equivalent of the standard unix read routine, with the added size parameter, that will perform byte swapping on platforms that use little endian byte order.

RETURN VALUE

c_read() returns the number of bytes successfully read. E_FAIL (-1) is returned if an error is encountered reading data or if the size or count parameters are invalid.