I wouldn’t mind writing my own function to do this but I was wondering if there existed one in the string.h or if there was a standard way to do this.
char *string = 'This is a string'; strcut(string, 4, 7); printf('%s', string); // 'This a string'
Thanks!
Use memmove to move the tail, then put ‘\0’ at the new end position. Be careful not to use memcpy – its behaviour is undefined in this situation since source and destination usually overlap.