dfgetsz: Get size of current LREC
Use this function to determine the size of the current logical record (LREC).
Last updated
- Changed for PUT11.
- Changed for PUT06.
- Changed for PUT00.
Format
unsigned int dfgetsz(dft_file *file); - file
- A pointer to the base address of the SW00SR slot (defined in c_sw00sr.h) of the file that you want to access and is returned by the dfopn function.
Entry requirements
None.
Return conditions
The size of the current LREC in bytes.
Error return
A value of 0 is returned if a previous operation did not locate an LREC.
Programming considerations
None.
Examples
The following example shows a
function that can be called after the dfred function was called
with a buffer that was too small for the LREC being read. The example
releases the buffer, gets the actual LREC size, allocates a new buffer
with the correct size, and calls the dfred function.
#include <cdf.h>
dft_rec LREC_bigger_than_buffer(dft_fil *online_file_ptr,
struct dft_bam *bam_struct_ptr)
{
int buf_size;
freec(bam_struct_ptr->bam_buf);
buf_size = dfgetsz(online_file_ptr);
bam_struct_ptr->bam_buf = malloc(buf_size);
llr_ptr = dfred(online_file_ptr, DFRED_BAM | DFRED_CURRENT);
return(llr_ptr);
}