in range strcpy

mvmalderen 0 Tallied Votes 272 Views Share

Usage:: [B]ir_strcpy[/B]( [I]destination[/I], [I]source[/I], [I]range_begin[/I], [I]range_end[/I]); example:

char test[] = "Hello World!!!";
char test2[20];
ir_strcpy(test2, test, 1, 3); /* test2 now contains 'ell' */
/**
@author: Mathias Van Malderen (tux4life)
*/

void ir_strcpy( char *s1, const char *s2, int rb, int re )
{
    while( (rb <= re) && (*s1++ = s2[rb]) ) rb++;
    *s1 = 0;
}