Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void buff_management(char *str, char mode)
- {
- static char buff[BUFF_SIZE];
- static char *buff_ptr = buff;
- if (!mode)
- {
- while (*str)
- {
- if (buff_ptr - buff >= BUFF_SIZE - 1)
- {
- write(1, buff, strlen(buff));
- buff_ptr = buff;
- memset(buff_ptr, 0, BUFF_SIZE);
- }
- *buff_ptr = *str;
- str++;
- buff_ptr++;
- }
- }
- else
- {
- write(1, buff, strlen(buff));
- buff_ptr = buff;
- memset(buff_ptr, 0, BUFF_SIZE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement