diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:08:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:08:18 +0000 |
commit | 5da14042f70711ea5cf66e034699730335462f66 (patch) | |
tree | 0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/fluent-bit/lib/lwrb/docs/examples_src/example_minimal.c | |
parent | Releasing debian version 1.44.3-2. (diff) | |
download | netdata-5da14042f70711ea5cf66e034699730335462f66.tar.xz netdata-5da14042f70711ea5cf66e034699730335462f66.zip |
Merging upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fluent-bit/lib/lwrb/docs/examples_src/example_minimal.c')
-rw-r--r-- | src/fluent-bit/lib/lwrb/docs/examples_src/example_minimal.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/lwrb/docs/examples_src/example_minimal.c b/src/fluent-bit/lib/lwrb/docs/examples_src/example_minimal.c new file mode 100644 index 000000000..c2333088f --- /dev/null +++ b/src/fluent-bit/lib/lwrb/docs/examples_src/example_minimal.c @@ -0,0 +1,19 @@ +#include "lwrb/lwrb.h" + +/* Declare rb instance & raw data */ +lwrb_t buff; +uint8_t buff_data[8]; + +/* Application variables */ +uint8_t data[2]; /* Application working data */ + +/* Application code ... */ +lwrb_init(&buff, buff_data, sizeof(buff_data)); /* Initialize buffer */ + +/* Write 4 bytes of data */ +lwrb_write(&buff, "0123", 4); + +/* Print number of bytes in buffer */ +printf("Bytes in buffer: %d\r\n", (int)lwrb_get_full(&buff)); + +/* Will print "4" */
\ No newline at end of file |