c_fwrite - Converts data to big endian and writes it to an output file

SYNTAX

#include "lasfileio.h"

size_t c_fwrite 
(
     const void *buf,
     size_t size,
     size_t count,
     FILE *stream
)

PARAMETERS

buf (input, VOID *)

Pointer to a buffer of data to write to the output file. The data is converted from the local byte order to big endian byte order before writing.

size (input, size_t)

Specifies the size, in bytes, of each element write to the file. This is limited to be 1, 2, 4, or 8 bytes to match the sizes of standard data types.

count (input, size_t)

Specifies the number of elements of size bytes to write to the file.

stream (input, FILE *)

Pointer to the file to write. This file should be opened by the standard C fopen call.

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_fwrite() routine is the equivalent of the standard C fwrite routine that will perform byte swapping on platforms that use little endian byte order.

RETURN VALUE

c_fwrite() returns the number of items successfully written. If an error occurs the return value is a short item count. E_FAIL (-1) may be returned if the size or count parameters are invalid.