RfileRead
Syntax | |||||||||||||||||||||||||
int RfileRead(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. Data in the The first line encountered that is not a comment is the time stamp of the record and should consist of the full date and time of the start and end of the record:
The next line defines the number of blocks within the record:
Each record is comprised of one or more blocks of data. A block consists of a header followed by a number of data entries. A data entry consists of a number of fields, the type of data fields within a block are always identical. The first line in the block header defines the number of entries in the block and the number of fields per entry:
The following three lines identify the entry fields. The first line gives the names of the fields, the next line give the units associated with that field and the final line gives the data type of the field.
The data type can be one of:
After the header comes the body of the block. Each line in the body is a data entry and must have the same number of columns as the block has fields. The number of lines in the body must be equal to the number of entries defined in the block header.
The following is an example of an
The 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 | |||||||||||||||||||||||||
|