++ ifstream (), ofstream () fstream ( ) (. 8).
istream, ostream iostream . − , , -, . , .
++ . . ifstream ofsream:
ofstream(const char* Name, int nMode= ios::out, int nPot= filebuf::openprot);
ifstream(const char* Name, int nMode= ios::in, int nPot= filebuf::openprot);
( ).
(|) :
ios::app , ostream::seekp;
ios::ate . ( ) ;
ios::in ; , ;
ios::out ( ofstream ); , ;
ios::trunc , ( ). , ios::out , ios::ate, ios::app ios:in ;
ios::nocreate , ;
ios::noreplace , ;
ios::binary − ( ).
:
ios::out | ios::trunc () ;
ios::out | ios::app .;
ios::in | ios::out ;
ios::in | ios::out | ios::trunc () ;
ios::in | ios::out | ios::app .
filebuf .
nProt:
filebuf::sh_compat ;
filebuf::sh_none Exclusive: ;
filebuf::sh_read ;
filebuf::sh_write .
filebuf::sh_read filebuf::sh_write (||).
, . open, , , :
void open(const char* name, int mode, int prot=fileout::openprot);
( , open), .
#include iostream>
#include <fstream>
using namespace std;
#include "string.h"