Truncates a multibyte character string at a specified length.
#include <stdlib.h> char *truncmb ( const char *string, size_t max);
(IN) Points to a multibyte string.
(IN) Specifies the maximum number of bytes (not characters) for the truncated string. This is done by writing a null-terminating character at that position or the one before it.
Returns a pointer to the truncated string.
If the host configuration supports multibyte characters, the truncmb function uses the host table, as recorded by the library at start up, to determine the character where the string can be safely truncated without orphaning a character's lead byte or exceeding the length specified by the max parameter. The truncated string length is ultimately either max or max-1, because NetWare supports only double-byte characters.
If string+max is not a valid memory address, a page fault occurs. The truncmb function does not check to see if the string is null-terminated before the position specified by max, but simply writes a null-terminating character at the specified max position.