I'm currently working on some C code to forward CAN messages via bluetooth and vice versa (µC stuff). The problem is that my paired bluetooth device uses '00' as a command and my bluetooth library is using a char[] to buffer the string when receiving from BT. This inevitably terminates the string, because it interprets the command as a NULL character. Also, any empty data byte in a CAN frame would cause the same problem.
I was able to solve the problem when going from CAN to BT by storing the CAN message in a byte array and sending a series of bytes followed by a CR to the BT module, but the other way round isn't that easy, as the BT library is using all sorts of string based commands.
Is there an easy way to prevent the NULL to cause an unwanted termination or do I have to rewrite the whole library to a suitable data type, and which one would work best in this case? Any ideas appreciated!