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

Functions

EXPORT errno_t strstr_s (char *dest, rsize_t dmax, const char *src, rsize_t slen, char **substring)
 The strstr_s() function locates the first occurrence of the substring pointed to by src which would be located in the string pointed to by dest. More...
 

Function Documentation

◆ strstr_s()

EXPORT errno_t strstr_s ( char *  dest,
rsize_t  dmax,
const char *  src,
rsize_t  slen,
char **  substring 
)

The strstr_s() function locates the first occurrence of the substring pointed to by src which would be located in the string pointed to by dest.

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 be searched for the substring
[in]dmaxrestricted maximum length of dest string
[in]srcpointer to the sub string
[in]slenthe maximum number of characters to use from src
[out]substringthe returned substring pointer
Precondition
Neither dest nor src shall be a null pointer.
Neither dmax nor slen shall not be 0.
Neither dmax nor slen shall not be greater than RSIZE_MAX_STR.
Return values
EOKwhen successful operation, substring found.
ESNULLPwhen dest/src/substring is NULL pointer
ESZEROLwhen dmax/slen = 0
ESLEMAXwhen dmax/slen > RSIZE_MAX_STR
ESNOTFNDwhen substring not found
See also
strprefix_s(), strspn_s(), strcspn_s(), strpbrk_s()