My application receives BINARY word-aligned data via character arrays. In other words, the sending application has a struct containing floats, ints, chars, etc. and what the application does is basically memcpy the struct into a char buffer and sends that buffer to my application.

My application recieves (a copy of) the buffer in a message, drops the buffer to a file, and then uses ifstream to open the file as a stream and reads data from it.

My question is can I cut out the "dropping the buffer to a file" part and read data directly from the allocated char buffer as if it was a stream? If so, how do I set up the char buffer as an input stream?

Thank you for your advice.