Home
Highly Reusable Software By activity User Interface Text Strings Math Processing
Stored Data
Communications
Hard World File System
|
#License - #Source code - #Example Use -
#include <librock/target/types.c> #include <librock/astring.h> int librock_afgettoch( char * *ppasz, FILE *f, char chStop, );
The return value is the number of characters read and stored. The location of the (possibly moved) buffer is stored at *ppasz.
These functions are part of the Librock allocated string functions. See () for an overview. Since the librock allocated string buffers hold NUL terminated strings, most "read-only" string functions of libc and other libraries, such as strlen(), strchr(), can be used.
As with all librock_astr* functions, the caller must assume the buffer
will move, and consider all pointers into the old buffer *ppasz
unusable.
See the () implementation for a good way to use indexes
to avoid pointers which go stale.
The allocation function, librock_astrensure(), makes realloc requests in multiples of a fixed size. The primary benefit of this strategy is to reduce realloc calls by assuming the buffer is at least a minimum size. For this and other reasons, be sure to call only with *ppasz set to 0 or a value obtained from a previous call to one of these functions.
Typical Use
char *asz =0; while(librock_afgettoch(&asz,f,'\f')) { /* Process asz Here */ }
int librock_afgettochX( char * *ppasz, FILE *f, char chStop, void *(*reallocfn)(void *,size_t) );
fgetc() feof() librock_astrensureX(), librock_astrfreeX() realloc() // used by librock_afgettoch
Copyright 1998-2000 Forrest J. Cavalier III, http://www.mibsoftware.com Open-source under MIT license. NO WARRANTY. Copies must retain this block. License text in <librock/license/mit.txt> librock_LIDESC_HC=cc598307414a9997b32b60a2e7a8e7c6a13d6438
Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)
Want to help? We welcome comments, patches. -- Need help? Request paid support.