test_ringbuffer_read.cpp 406 B

12345678910111213141516
  1. #include "ringbuffer.h"
  2. #include <stdio.h>
  3. #include <string.h>
  4. int main()
  5. {
  6. RingBuffer rb((char*)"ringbuffer.data",0);
  7. char data[1024]={0};
  8. int count = rb.read(data,sizeof(data));
  9. fprintf(stderr,"data %i [%s]\n",count,data);
  10. fprintf(stderr,"userdata size %i\n",USERDATA_SIZE);
  11. int* tmp = (int*)rb.getUserdata();
  12. fprintf(stderr,"hatsune miku was released in %i\n",*tmp);
  13. }