- #1
yungman
- 5,755
- 293
I have been studying binary files, my main textbook is not very clear, the other 3 books are useless. I went on line and read a lot of articles. I want to run it by you guys whether I am correct or not:
1) Binary files are written in binary or Hex( same to me that read 4 binary as each hex). Text files are written in ASCII( still binary in the sense the number means characters). They are of different use, some are better in some cases and not as good in others. Bottom line, text files and binary files are like English and Chinese writings...They are just different. Just that simple.
Yes, I understand there are a lot of details like .exe, .jpg, .png etc are all in binary etc. etc. Those are just details.
2) fstream has different function objects to work on text files and binary files. You have to specify binary(ios::binary) or else it is treated as text files. Then you have function objects to translate back and fore (reinterpret_cast). You literally treat text and binary files as different as apple and orange.
Let me know whether I am correct. I have some more questions later.
Thanks
1) Binary files are written in binary or Hex( same to me that read 4 binary as each hex). Text files are written in ASCII( still binary in the sense the number means characters). They are of different use, some are better in some cases and not as good in others. Bottom line, text files and binary files are like English and Chinese writings...They are just different. Just that simple.
Yes, I understand there are a lot of details like .exe, .jpg, .png etc are all in binary etc. etc. Those are just details.
2) fstream has different function objects to work on text files and binary files. You have to specify binary(ios::binary) or else it is treated as text files. Then you have function objects to translate back and fore (reinterpret_cast). You literally treat text and binary files as different as apple and orange.
Let me know whether I am correct. I have some more questions later.
Thanks