Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char * strmid(char * dest, char * source, int start, size_t count, int maxlength) {
- maxlength = sizeof(dest);
- source[0] = '\0';
- if(dest != NULL) {
- size_t len = strlen(dest);
- if(start < 0) start = len + start;
- if(start >= 0 && start < len) {
- if(count == 0 || count > len - start) count = len - start;
- if(count < maxlength) {
- strncpy(source, dest + start, count);
- source[count] = 0;
- }
- }
- }
- return source;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement