Nearly there

I am making good progress with my UI, I was set back for a day or two trying to chase down bugs in my code.
Each field is a []byte buffer 512 bytes long. When user inputs into the field the buffer stays fixed but existing null bytes are overwritten. Whdn doing a string conversion these null bytes are preserved but not printed.
This made it hard to diagnose. I eventually converted a []byte to a string and back to a []byte and noticed the length was still 512. At that moment I realised the null bytes where being copied. I now use a trim function to remove the null bytes before string conversion. And now everything works!
Because this program uses a C library bug tracking is more difficult than with normal Go.

Leave a comment

Your email address will not be published. Required fields are marked *