The function can be written for example the following way
char * strCut( char *s, const char *pattern )
{
if ( char *p = std::strstr( s, pattern ) )
{
char *q = p + std::strlen( pattern );
while ( *p++ = *q++ );
}
return s;
}
Or there could be used function std::memmove
instead of the inner loop.