21 lines
775 B
Markdown
21 lines
775 B
Markdown
## Binary Editor
|
|
|
|
This is a very simple c library for reading and writing individual bits.
|
|
|
|
#### Usage:
|
|
|
|
First, you should initialize the input and output buffers with
|
|
|
|
```
|
|
setBuffer(BUF_IN, bufferToRead)
|
|
setBuffer(BUF_OUT, bufferToWrite);
|
|
```
|
|
|
|
From here, you can read individual bits with `readBit()` or a whole byte with readByte(). For writing, use `writeBit()` and `writeByte()`.
|
|
|
|
**Note**: The way writing works, it will not override something already in the buffer, instead only messing up data. Make sure to initialize your buffers to 0 for writing to work correctly.
|
|
|
|
If you want to go back to a different part of a buffer, you can seek with
|
|
|
|
`seekBuffer(BUF_IN or BUF_OUT, numInBits)`You can also get the current bit offest with `getBufferOffset(BUF_IN or BUF_OUT)`
|