
reading text files in binary mode
Quote:
> Gergo Barany a crit dans le message ...
> >> > / Does opening a text file in binary mode give you a more accurate
> >> > / "picture" of the file. I am opening a file in "r" mode and there
> >[snip]
> >> > You can try open mode "rb".
> >> That's it? I don't have to make any other changes in my code?
> >That's basically it. Read it byte by byte into unsigned chars and print
> >their hex/octal/decimal representations.
> Not an unsigned char but an int rather, because the value of EOF is by
> definition a negative int and have to be tested after any read, and not to
> be processed like a data.
I was thinking of reading the unsigned chars and checking feof() after
each read. But your way is just as good (or even better).
Gergo
--
"Because he's a character who's looking for his own identity, [He-Man is]
an interesting role for an actor."
-- Dolph Lundgren, "actor"
GU d- s:+ a--- C++>$ UL+++ P>++ L+++ E>++ W+ N++ o? K- w--- !O !M !V
PS+ PE+ Y+ PGP+ t* 5+ X- R>+ tv++ b+>+++ DI+ D+ G>++ e* h! !r !y+