#include #include #include #include "ilenstr.h" int main () { ilenstr ilstr; /* C-compatible string. */ ilstr = new_ilenstr ("hello"); printf ("ilstr = %s\n", ilstr); printf ("len(ilstr) = %zu\n", ilstrlen (ilstr)); free (ilstr); /* String containing a \0 character. */ ilstr = new_ilenstr_with_len ("hello\0world", 11); /* Passing the string to a legacy function only prints * up to the \0 character. */ printf ("ilstr = %s // should be truncated\n", ilstr); /* The length function still works. */ printf ("len(ilstr) = %zu\n", ilstrlen (ilstr)); free (ilstr); }