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[0] = bits[31:24], Char[1] = bit[23:16], Char[2] = bit[15:8], Char[3] = 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.