I'm trying to read from standard input and distinguish each character from one another by its decimal value. From what I understand, a Line Feed (10) and a Carriage Return (13) will be interpreted as the same character. I want to distinguish between the two. I know if I was reading from a file I could open it using the ios::binary parameter. But what about if I am reading from standard input?
stdinusing anifstream(the point I can't do it in a portable way,/dev/stdinshould work for -ixes), then userdbufto hook that intostd::cin.std::freopen(but it looks kind of hacky). It would be nice if someone provided a canonical answer with examples for BSDs, Linux, OS X, Solaris and Windows.