safec  3.0
Safe C Library - ISO TR24731 Bounds Checking Interface
strnterminate_s.c File Reference
#include "safe_str_lib.h"
+ Include dependency graph for strnterminate_s.c:

Functions

EXPORT rsize_t strnterminate_s (char *dest, rsize_t dmax)
 The strnterminate_s function will terminate the string if a null is not encountered before dmax characters. More...
 

Function Documentation

◆ strnterminate_s()

EXPORT rsize_t strnterminate_s ( char *  dest,
rsize_t  dmax 
)

The strnterminate_s function will terminate the string if a null is not encountered before dmax characters.

Remarks
EXTENSION TO ISO/IEC TR 24731-1, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
Parameters
destpointer to string
dmaxmaximum length of string
Precondition
dest shall not be a null pointer.
dmax shall not equal zero.
dmax shall not be greater than RSIZE_MAX_STR.
Returns
The function returns a terminated string. If a null is not encountered prior to dmax characters, the dmax character is set to null terminating the string. The string length is also returned.
See also
strnlen_s()