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.

Screenshot_2018-04-13_23-43-17

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s