Files
mars-libowfat/textcode/scan_to_array.c
2025-01-20 18:07:12 +00:00

13 lines
393 B
C

#include <libowfat/str.h>
#include <libowfat/array.h>
#include <libowfat/textcode.h>
size_t scan_to_array(size_t (*func)(const char*,char*,size_t*),
const char* src,array* dest) {
size_t scanned;
size_t needed=str_len(src);
char* x=((char*)array_start(dest))+array_bytes(dest);
if (!array_allocate(dest,1,array_bytes(dest)+needed-1)) return 0;
return func(src,x,&scanned);
}