RfileReadRaw
Syntax | |||||||||||
int RfileReadRaw(FILE *fp,int num,RfileDecoder *decode, void **data); | |||||||||||
Header | |||||||||||
general/rfile.h | |||||||||||
Library | |||||||||||
rfile | |||||||||||
Description | |||||||||||
The The data is read from the I/O stream pointed to by the argument fp. The function uses a series of user supplied decoder functions to interpret the contents of each block. The number of decoder functions and the array of pointers to them are defined by the arguments num and decode respectively.The user must also supply a block of memory for each decoder function to store its results. Pointers to these memory blocks are stored in the array pointed to by the argument data. Different decoder functions can share the same memory by setting the appropriate entries in the array to point to the same value. A decoder function has the form:
The decoder functions have a type associated with them:
As a data entry is read from a block, each decoder functions will be called in turn.The first three arguments are space separated text strings giving the name of the fields in the block, the units of each field, and the data type associated with each field. The function should compare these strings with the fields of the block type it can decode. If the function does not recognize this type of block it should take no further action and return a value of zero. If a match is found the function should decode the entry using the remaining arguments and return a value of (1). The arguments st_time and ed_time give the start end end time of the record in terms of seconds from 0:00UT January 1, 1970. The argument nent give the number of data entries in the data block and the argument nfld gives the number of fields per entry. The index number of the entry to decode is given by the argument ent. The argument fdat is a pointer to an array of structures containing the decoded fields of the data entry. This structure includes a flag indicating the type of data. Possible values of this flag are:
The function should copy the appropriate member of the union for each element in the array into its data buffer pointed to by the argument ptr. If no decoder functions are defined, the function will extract the start end end time of each data record. If the argument data is not a NULL pointer it is ssumed to be a pointer to an array of double precision floating point numbers used to store the record times measured in seconds from 00:00UT January 1, 1970. | |||||||||||
Returns | |||||||||||
Returns the number of bytes read from the stream if a record is successfully read. On error, (-1) is returned. | |||||||||||
Errors | |||||||||||
On error, (-1) is returned. | |||||||||||
Example | |||||||||||
|