Skip to content

Instantly share code, notes, and snippets.

@awsong
Last active August 29, 2015 14:13
Show Gist options
  • Save awsong/a90896df42990cd13773 to your computer and use it in GitHub Desktop.
Save awsong/a90896df42990cd13773 to your computer and use it in GitHub Desktop.
int catvars(char *buf1, char *buf2, unsigned int len1,
unsigned int len2){
char mybuf[256];
if((len1 + len2) > 256){ /* [3] */
return -1;
}
memcpy(mybuf, buf1, len1); /* [4] */
memcpy(mybuf + len1, buf2, len2);
do_some_stuff(mybuf);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment