|
LIBRARY#include <xtend/file.h> -lxtend SYNOPSISssize_t xt_inhale_strings(FILE *stream, char ***list) ARGUMENTSstream FILE * from which strings are read, one per line list Pointer to a char ** (poiner array), populated with strings DESCRIPTIONxt_inhale_strings() reads a list of strings from a file, one per line, into a pointer array. Memory is allocated for the pointer array and for each string.Memory should be freed using xt_free_strings(3) as soon as the strings are no longer needed. Inhaling large amounts of data into arrays should generally be avoided in favor of more memory-efficient use-once-and-discard strategies, but may be advantageous for small lists of strings accessed repeatedly, or necessary for a few tasks such as sorting. RETURN VALUESThe number of strings read, XT_READ_IO_ERR on read errorEXAMPLESFILE *instream; char **strings; ssize_t string_count; string_count = xt_inhale_strings(instream, &strings); xt_free_strings(strings); SEE ALSOxt_free_strings(3) Visit the GSP FreeBSD Man Page Interface. |