We recommend using Visual Studio 2017

_strninc, _wcsninc, _mbsninc, _mbsninc_l


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _strninc, _wcsninc, _mbsninc, _mbsninc_l.

Advances a string pointer by n characters.

System_CAPS_ICON_important.jpg Important

_mbsninc and _mbsninc_l cannot be used in applications that execute in the Windows Runtime. For more information, see CRT functions not supported with /ZW.

char *_strninc(  
   const char *str,  
   size_t count   
wchar_t *_wcsninc(  
   const wchar_t *str,  
   size_t count   
unsigned char *_mbsninc(  
   const unsigned char *str,  
   size_t count   
unsigned char *_mbsninc(  
   const unsigned char *str,  
   size_t count,  
   _locale_t locale  


Source string.

Number of characters to increment a string pointer.

Locale to use.

Each of these routines returns a pointer to str after str has been incremented by count characters or NULL if the supplied pointer is NULL. If count is greater than or equal to the number of characters in str, the result is undefined.

The _mbsninc function increments str by count multibyte characters. _mbsninc recognizes multibyte-character sequences according to the multibyte code page currently in use.

Generic-Text Routine Mappings

Tchar.h routine_UNICODE and _MBCS not defined_MBCS defined_UNICODE defined

_strninc and _wcsninc are single-byte–character string and wide-character string versions of _mbsninc. _wcsninc and _strninc are provided only for this mapping and should not be used otherwise. For more information, see Using Generic-Text Mappings and Generic-Text Mappings.

_mbsninc_l is identical except that it uses the locale parameter passed in instead. For more information, see Locale.

RoutineRequired header

For more compatibility information, see Compatibility.

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

String Manipulation
Interpretation of Multibyte-Character Sequences
_strdec, _wcsdec, _mbsdec, _mbsdec_l
_strinc, _wcsinc, _mbsinc, _mbsinc_l
_strnextc, _wcsnextc, _mbsnextc, _mbsnextc_l