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

Functions

EXPORT errno_t strchr_s (const char *restrict dest, rsize_t dmax, const int ch, char **result)
 Finds the first occurrence of ch (after conversion to char as if by (char)ch) in the null-terminated byte string pointed to by dest (each character interpreted as unsigned char). More...
 

Function Documentation

◆ strchr_s()

EXPORT errno_t strchr_s ( const char *restrict  dest,
rsize_t  dmax,
const int  ch,
char **  result 
)

Finds the first occurrence of ch (after conversion to char as if by (char)ch) in the null-terminated byte string pointed to by dest (each character interpreted as unsigned char).

The terminating null character is considered to be a part of the string and can be found when searching for '\0'.

Remarks
IMPLEMENTED IN
Parameters
[in]destpointer to string to compare against
[in]dmaxrestricted maximum length of dest
[in]chcharacter to search for
[out]resultpointer to char* in dest
Precondition
Neither dest nor result shall be a null pointer.
dmax shall not be 0.
dmax shall not be greater than RSIZE_MAX_STR.
ch shall not be greater than 255
Return values
EOKwhen successfully character found.
ESNULLPwhen dest/result is a NULL pointer
ESZEROLwhen dmax = 0
ESLEMAXwhen dmax > RSIZE_MAX_STR
ESLEMAXwhen ch > 255
ESNOTFNDwhen ch not found in dest
See also
memchr_s(), strspn_s(), strcspn_s(), strpbrk_s(), strstr_s()