Category : C Source Code
Archive   : TCCLB2.ZIP
Filename : STRINS.C

 
Output of file : STRINS.C contained in archive : TCCLB2.ZIP
#include
#include

char *strins ( char *string, int start, char *insstr )
{
register int smaxlen, imaxlen;
char *success;

smaxlen = strlen (string);
imaxlen = strlen (insstr);
--start; /* make start zero relative */
if ( start < smaxlen ) { /* +1 for null char */
success = malloc (smaxlen - start + 1 );
memcpy (success, &string[start], smaxlen - start + 1);
memcpy (&string[start], insstr, imaxlen);
memcpy (&string[start] + imaxlen, success, smaxlen - start + 1);
free (success);
success = string;
}
else
success = NULL;

return (success);
}



  3 Responses to “Category : C Source Code
Archive   : TCCLB2.ZIP
Filename : STRINS.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/