Closed Ectalite closed 2 years ago
read_ctic returns the number of bytes read, not the error code. The value of ERROR_FATAL happens to be 3. If there is an error in read_ctic, it will print a message describing the problem.
if(read_ctic(...) == 0)
{
error = read_error();
if(error == ERROR_FATAL)
....
Oh no, I'm sorry, I missread the README, because at https://github.com/petzval/btferret#4-2-28-read_ctic it is written that read_error() gives out ERROR_FATAL. But yeah, read_ctic is not read_error() So it's not a bug!
I found a bug by calling the read_ctic function. After trying out multiple times, I found out that reading 1, 2 and 4 bytes does work but not 3 (gives ERROR_FATAL). (For my particular case I am sending a 3 byte long information for rgb colors).
Here is the code I'm using: