ios question

Hi, can I know how to use this actually? And what are them? Thanks :)

1
2
ios::binary
ios::ate

closed account (o3hC5Di1)
Hi there,

This page: http://www.cplusplus.com/doc/tutorial/files/
Ass does this: http://www.cplusplus.com/reference/iostream/ios_base/openmode/

Describe those.

Hope that helps.
All the best,

NwN
Last edited on
Hi thanks, actually I have read those...but don't understand what it means by this

Open in binary mode.

I need example to see the result, then only can understand that :)
closed account (o3hC5Di1)
Hi,

Sorry, I'm just a beginner myself, but I did come up with this:

http://stackoverflow.com/questions/2225600/whats-the-difference-between-opening-a-file-with-iosbinary-or-iosout-or-bot

Maybe someone with more experience would be kind enough to give a better explanation than myself.

All the best,
NwN
Last edited on
closed account (zb0S216C)
ios::binary opens the file in binary mode. In binary mode, special characters, such as newline & carriage return, are read as they are; they are not translated into escape sequences. Basically, what you read is what you get, not magic.

ios::ate sets the initial reading position to the end of the file.
ios::trunc removes everything from the file before writing in the new data. Based on the behaviour of std::ofstream, this flag is initially set.

ios::app adds any new data to the end of the file. The old data remains unmodified.

Wazzak
Last edited on
Topic archived. No new replies allowed.