wovo / hwlib

C++ OO micro-controller library for close-to-the-hardware programming
Boost Software License 1.0
57 stars 26 forks source link

New line but no carriage return #11

Closed CvRXX closed 3 years ago

CvRXX commented 6 years ago

https://github.com/wovo/hwlib/blob/a8db26e71ca00f29e2e5797befd1189cf298641a/library/hwlib-ostream.hpp#L27

The \n in the above line does not do a carriage return in most Linux serial viewers. I think an \r should be added but then it's not a single char anymore.

wovo commented 3 years ago

from https://www.cplusplus.com/reference/ostream/endl/ :

Its behavior is equivalent to calling os.put('\n') (or os.put(os.widen('\n')) for character types other than char), and then os.flush().

Currently the ostream is not buffered, so the flush part can be ignored.

The real problem is that '\n' is supposed to send or , depending on the conventions of the host, that is, the platform the code is running on. So there is no obligation to do either way.