How do I implement my own custom stream in C++?
Why?
I want to send data from one micro-controller to another using a wired connection and I think a custom stream is the most intuitive way.
Example:
#include "myStream.h" int main() { myStream << "Hello world!"; return 0; } EDIT:
Solution:
class Stream { private: // members public: Stream() {} friend Stream& operator<<(Stream& stream, const Whatever& other); }; Stream& operator<<(Stream& stream, const Whatever& other) { // do something return stream; }
endl), start here: stackoverflow.com/questions/772355/…