Created
October 19, 2022 15:12
-
-
Save guangxuanliu/c62d266399920f5023f0175255bd49ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define m 16 | |
char buffer[m] = {0}; | |
int index = 0; | |
void fillBuffer(const char *buf, int n) | |
{ | |
if(index + n <= m) | |
{ | |
memcpy(buffer + index, buf, n); | |
index += n; | |
} | |
else | |
{ | |
memcpy(buffer + index, buf, m - index); | |
//print here | |
index = 0; | |
fillBuffer(buffer, n - (m - index)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment