Heh, it is easy to overlook unfamiliar tags in cout statements. Without the std:: on them, its very frustrating to tell variables and formatting apart for the less commonly used formatting keywords. The std:: contributes a lot here where most of the time it is visual clutter.
I tried to apply this stuff at writing a hex-printing program, but only spits garbage if I try it on binary files.
I guess, that's because I set the wrong properties to the ostream. But I'm a relative rookie dealing with the settings of streams, so I don't know what to do.
keep in mind that text files ARE 'binary' files. The language makes a distinction so you can use tools that do specific things because its 'text' that are mighty handy, but the above will work on text files too (its going to print hex for the end of lines and other whitespace, but it works, and remember that eol may be 2 chars long, 10/13 byte values usually).
The program of JLBorges works good, but the output is somewhat erroneous, At the time I'm trying to find the error, but I have no clue where I need to search.