Defining maximum size of a string argument passed to a UDF

By: Borland Staff

Abstract: You must account for the null character at the end of the string.

How do I have to declare the input parameter of a UDF if I want to call  it with a maximum length of n 
characters?   If I define it as "cstring(n)", I get an error ("string truncation...") when I call it with a maximum 
length string.   When I try it with cstring(n+1)  it works. Is this the right way to declare it?

Note: This information applies to all InterBase versions.

Cstrings are null terminated.  As a result,  you have to take into account the fact that there is an extra 
character on the end of the string.   Otherwise, you are trying to force the system to truncate the
last character in the string, the null character.

Server Response from: ETNASC03