Search code examples
c++streambinarystdincin

Reading from standard in using ios::binary


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?


Solution

  • You can read from std::cin by using get. This method is specially designed for reading unformatted data (see doc)