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

Functions

EXPORT errno_t strlastchar_s (char *dest, rsize_t dmax, char c, char **last)
 Returns a pointer to the last occurrence of character c in dest. More...
 

Function Documentation

◆ strlastchar_s()

EXPORT errno_t strlastchar_s ( char *  dest,
rsize_t  dmax,
char  c,
char **  last 
)

Returns a pointer to the last occurrence of character c in dest.

The scanning stops at the first null or after dmax characters.

Remarks
EXTENSION TO ISO/IEC TR 24731, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
Parameters
[in]destpointer to string to compare against
[in]dmaxrestricted maximum length of string
[in]ccharacter to locate
[out]lastreturned pointer to first occurrence of c
Precondition
dest shall not be a null pointer.
last shall not be a null pointer.
dmax shall not be 0
dmax shall not be greater than RSIZE_MAX_STR
Returns
pointer to last occurence of c, NULL if not found
Return values
EOKwhen pointer to last occurrence is returned
ESNULLPwhen dst/first is NULL pointer
ESZEROLwhen dmax = 0
ESLEMAXwhen dmax > RSIZE_MAX_STR
See also
strfirstchar_s(), strfirstdiff_s(), strfirstsame_s(), strlastdiff_s(), strlastsame_s()