cprc/src/ringbuffer.c

16 lines
248 B
C

#include <stdio.h>
#define BUFSIZE 64
int main(void) {
char buffer[BUFSIZE] = {'\0'}, c;
int i=0;
while ((c=getchar())!=EOF) {
buffer[i++]=c;
if (i==BUFSIZE-1)
i=0;
printf("Buffer is now: %s\r", buffer);
}
printf("\n");
return 0;
}