Next: , Previous: I/O, Up: I/O


7.1 fget_rec_new

Create a fget_rec buffer structure.

Synopsis

     #include <suplib/io.h>
     
     
     
void *fget_rec_new( size_t buf_size, size_t extend );

Parameters

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

Description

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’.

Returns

It returns a pointer to a buffer structure (not the actual buffer) or NULL if it was unable to allocate it.

Author

Diab Jerius