#include #include #include #include "rec_io.h" int main() { struct rec_io * r; const char * rec_str = "ciao \0\0 mamma"; const char separator[] = { ' ', 0, 0, ' ' }; char buffer[100]; r = rec_io_new(); assert(r); rec_io_set_separator(r, separator, separator + 4); rec_io_read_record(r, rec_str, rec_str + 13); size_t res = rec_io_write_record(r, buffer, 100, "%0--%0--%1"); assert(res == 18); assert(strcmp(buffer, "ciao--ciao--mamma") == 0); rec_io_destroy(r); return EXIT_SUCCESS; }