In C ++ files: which file is open as ios :: binary is different from the open as ios :: binary | IOS :: outside the home?

if I opened the file, for example:

ofstream file("file.dat",ios::binary);

or

ofstream file("file.dat",ios::binary | ios::out);

what can I do with a file opened in the last form, which I cannot do with the previous form and vice versa

Thank you

+5
source share
4 answers

Thanks to everyone who answered me: I have now checked several codes, depending on what I was answered, and came up with this summary:

: ios:: out , , ios:: in , ( read() → - ifstream), .

ifstream: ios:: in - , , ios:: out ifstream, ( write() < lt; or some ofstream object), .

fstream: , , . , , , .

, !

+1

astream, ios::out , . , , ios:: out, , fstream, , , .

+5

, , , .

(gcc 3.4.3) ios: out instream- > open() , , . fstream, .

+2

, 27.8.1.3 ios (, ios::in ios::out) C fopen(). , , , , .

27.8.1.9 , ofstream , ios::out . , .

, fstream ios::in ios::out, , . 27.8.1.3.

+2

All Articles