To change this, see Global state in the CRT. For more information, see Locale.īy default, this function's global state is scoped to the application. The versions of these functions that do not have the _l suffix use the current locale for this locale-dependent behavior the versions that have the _l suffix are identical except that they instead use the locale parameter that's passed in. The output value is affected by the locale-category setting of LC_CTYPE for more information, see setlocale, _wsetlocale. If you require the non- const behavior for both C++ overloads, define the symbol _CONST_RETURN. The macro _CRT_CONST_CORRECT_OVERLOADS is defined if both the const and non- const versions of these functions are available. The overload that takes a pointer to const returns a pointer to const the version that takes a pointer to non- const returns a pointer to non- const. In C, these functions take a const pointer for the first argument. For more information, see Avoiding Buffer Overruns. Buffer overrun problems can be used to attack a system because they can allow the execution of arbitrary code, which can cause an unwarranted elevation of privilege. These functions might incur a threat from a buffer overrun problem. These three functions behave identically otherwise. strstr and wcsstr do not validate their parameters. If execution is allowed to continue, _mbsstr sets errno to EINVAL and returns 0. If str or strSearch is NULL, the invalid parameter handler is invoked, as described in Parameter Validation. The arguments and return value of wcsstr are wide-character strings those of _mbsstr are multibyte-character strings. wcsstr is the wide-character version of strstr and _mbsstr is the multibyte-character version. The search does not include terminating null characters. The strstr function returns a pointer to the first occurrence of strSearch in str. If strSearch points to a string of zero length, the function returns str. Returns a pointer to the first occurrence of strSearch in str, or NULL if strSearch does not appear in str.
For more information, see CRT functions not supported in Universal Windows Platform apps. _mbsstr and _mbsstr_l cannot be used in applications that execute in the Windows Runtime.