Next: fget_rec_delete, Previous: I/O, Up: I/O
Create a fget_rec
buffer structure.
#include <suplib/io.h>void *fget_rec_new( size_t buf_size, size_t extend );
size_t buf_size
- the initial size of the buffer
size_t extend
- the amount to extend the buffer each time it is too small
This routine creates a buffer structure that can be used by
fget_rec
. The buffer structure should be destroyed with
fget_rec_delete
.
The calling procedure must provide the initial size of the buffer
(including the trailing '\0' which seals off the string),
as well as the amount by which the buffer should be extended if the
buffer is shorter than the input record. fget_rec
repeatedly
extends the buffer until a record fits, so this value needn't be
that large. Note that the buf_size
argument should be
greater than ‘1’.
It returns a pointer to a buffer structure (not the actual
buffer) or NULL
if it was unable to allocate it.
Diab Jerius