Correzioni alla apertura del file in lettura. Aggiunta delete
nel distruttore. git-svn-id: svn://10.65.10.50/trunk@5187 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
90c87f2224
commit
04a0a8edcf
@ -249,6 +249,14 @@ TFile_text::TFile_text(const char* file_name, const char* config_name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TFile_text::~TFile_text()
|
||||||
|
{
|
||||||
|
if (_read_file)
|
||||||
|
delete _read_file;
|
||||||
|
if (_write_file)
|
||||||
|
delete _write_file;
|
||||||
|
}
|
||||||
|
|
||||||
//Scrive su file il record_text (valido anche per header e footer)
|
//Scrive su file il record_text (valido anche per header e footer)
|
||||||
int TFile_text::write(TRecord_text& rec)
|
int TFile_text::write(TRecord_text& rec)
|
||||||
@ -559,9 +567,12 @@ int TFile_text::open(char mode)
|
|||||||
if (_read_file)
|
if (_read_file)
|
||||||
delete _read_file;
|
delete _read_file;
|
||||||
|
|
||||||
_read_file = new ifstream(_name, ios::binary);
|
_read_file = new ifstream(_name, ios::binary | ios::nocreate);
|
||||||
if (!ok_r())
|
if (!ok_r())
|
||||||
error_box("Impossibile aprire il file %s in lettura", (const char *)_name);
|
{
|
||||||
|
error_box("Impossibile aprire il file %s in lettura", (const char *)_name);
|
||||||
|
return _read_file->rdstate() != ios::goodbit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mode == 'w')//apertura in scrittura
|
if (mode == 'w')//apertura in scrittura
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
TFile_text(const char* file_name, const char* config_name);
|
TFile_text(const char* file_name, const char* config_name);
|
||||||
virtual ~TFile_text(){}
|
virtual ~TFile_text();
|
||||||
ifstream* read_file() {return _read_file;}
|
ifstream* read_file() {return _read_file;}
|
||||||
ofstream* write_file() {return _write_file;}
|
ofstream* write_file() {return _write_file;}
|
||||||
void set_gen_parm(TConfig& config, const TString& section);//scarica i parametri generali dal file di configurazione
|
void set_gen_parm(TConfig& config, const TString& section);//scarica i parametri generali dal file di configurazione
|
||||||
|
Loading…
x
Reference in New Issue
Block a user