# Char buffer library

**URL:** https://forum.xod.io/t/char-buffer-library/1720
**Category:** Look What I’ve Done
**Created:** [January 14, 2019, 4:28am UTC](https://forum.xod.io/t/char-buffer-library/1720 "2019-01-14T04:28:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![awgrover](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@awgrover](https://forum.xod.io/u/awgrover)
#### Post date: [January 14, 2019, 4:28am UTC](https://forum.xod.io/t/char-buffer-library/1720/1 "2019-01-14T04:28:04Z")

</div>

Several of the libraries I’ve been helping convert to XOD need a block of RAM as a buffer. So, to finish off those libraries, I wrote this library to provide a common buffer. I think of this as an experiment, since the XOD developers are thinking about this in a [broader way](https://forum.xod.io/t/provide-xod-core-buffer/1678/2). @bradzilla84 is also thinking about this.

I did it in a fairly obvious way: `malloc`, custom-type with char\*, and length.

Here’s a little taste:

 ![Screenshot%20from%202019-01-13%2023-26-47](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/b214cc6989232acf4320b0d00a24aa721f9e4065.png)

Library: [awgrover/buffer](https://xod.io/libs/awgrover/buffer1/), source: [github](https://github.com/awgrover/xod-buffer). As usual, feedback/critique will help improve the library/concept.

I spent some time writing the `example` patch which is also the test. I did not use `tabtest`, which I should revisit. I also spent time writing a `tutorial` patch to explain using the library (it has illustrative fragments). And, I wrote a `tutorial-cpp` patch to show how to use it with your `.cpp` patches when you need the buffer (including a skeleton).

Writing the `example` patch made me think more about “impure” nodes (and objects with state). I’ve improved my understanding, but still need more experience with it.

Next, help @cesars write the methods that need a buffer for the RF24 library. As in, actually use it.
