#include <fstream>
#include <iostream>
int rd( unsigned long int &value, char *fname );
int wr( unsigned long int value, char *fname );
int main() {
unsigned long int value_1, value_2,
error;
value_1 = 525075;
error = wr( value_1, "tst.txt" );
if( 0 != error )
return error;
error = rd( value_2, "tst.txt" );
if( 0 != error )
return error;
std ::cout << value_1 << std ::endl << value_2 << std ::endl;
return 0;
}
int rd( unsigned long int &value, char *fname ) {
std ::ifstream ifst( fname );
if( 0 == ifst )
return -1;
ifst >> value;
ifst .close();
return 0;
}
int wr( unsigned long int value, char *fname ) {
std ::ofstream ofst( fname );
if( 0 == ofst )
return -1;
ofst << value;
ofst .close();
return 0;
}