Figure 3.2 shows a fragment of code indicating how the previous example would be modified if the fixed-string interface were used. Note that return_string now becomes a pointer to explicitly malloc-ed memory. To open the query p(X,Y,Z) the function xsb_query_string_string_b() is called, with the _b indicating that a fixed buffer is being used rather than a VarString. The call is similar to xsb_query_string_string(), except that the length anslen of the buffer pointed to by return_string is now also required. If the answer to be returned (including separators) is longer than anslen, xsb_query_string_string_b() will return XSB_OVERFLOW. If this happens, a new answer buffer can be used (here the old one is realloc-ed) and the answer retrieved via xsb_get_last_answer_string. Similarly, further answers are obtained via xsb_next_string_b() whose length must be checked. Thus the only difference between the fixed-string level and the VarString level is that the length of each answer should be checked and xsb_get_last_answer_string() called if necessary.