For a project I am working on we're using libserial to communicate with out hardware. the problem with libserial is that when you call read() it returns an unsigned char and readline() returns a string. We're encoding our collected data from four sensors into 32 bit unsigned integer if I do a four unsigned character array some of our sensor data will be broken into pieces across two characters. My question is how would I be able to place all the bits into an unsigned long integer where Char = bits[31:24], Char = bit[23:16], Char = bit[15:8], Char = bit[7:0].
Also if we use the ReadLine() function we would have to place a new line character at the end of it so that the function knows when to stop reading. How would I remove the new line character before I process the bits.