Binary files

Hello,

When would you use a binary file as opposed to a text file? Also, if you are working with a binary file with flags ios::out | ios::in would you need to close the file before switching between .read and .write?

Thanks.
All files are stored in binary format, and the ios::bin flag does not actually interpret anything as binary. You still get text/bytes, but the stream is given the ability to use seek and the likes. A file is what you make of it - if you read text, it's text; if you read bytes, it's bytes. But text is made up of bytes, and bytes make up text. They are exactly the same and no different. Do not think they are different or not the same - you're only looking at the information from a different angle.
Topic archived. No new replies allowed.