diff --git a/include/filetext.cpp b/include/filetext.cpp index be09c3bcf..b64ce6163 100755 --- a/include/filetext.cpp +++ b/include/filetext.cpp @@ -80,6 +80,11 @@ const TString& TRecord_text::row(int pos) const return _array.row(pos); } +TString& TRecord_text::row(int pos) +{ + return _array.row(pos); +} + void TRecord_text::add(const TString& c, int pos) { _array.add(c, pos); @@ -464,14 +469,15 @@ int TFile_text::autosave(TRelation& rel, const TRecord_text& rec) TTracciato_record& tr = t_rec(type); TArray& a_tc = tr.tracciati_campo(); int items = a_tc.items(); + TString valore; for (int i = 0; i < items; i++) { const TTracciato_campo& tc = tr.get(i); const TFieldref& field = tc.field(); if (field.name().not_empty()) { - const TString& valore = rec.row(i); - field.write(valore, rel);//faccio una write sulla relazione del fieldref + valore = rec.row(i); + field.write(valore, rel);//faccio una write sulla relazione del fieldref } } int err = rel.write(); @@ -558,7 +564,10 @@ TString& TFile_text::format_field(TTracciato_campo& tc, TString& campo) int pos = tc.position(); int length = tc.length(); if (!tc.picture().blank()) - campo.picture(tc.picture(), campo); + { TString tmp; + tmp.picture(tc.picture(), campo); + campo=tmp; + } if (length > campo.len()) { if (tc.align() == 'R') diff --git a/include/filetext.h b/include/filetext.h index 8a9f6c872..73b5af4a0 100755 --- a/include/filetext.h +++ b/include/filetext.h @@ -101,6 +101,7 @@ public: const TString& type() const {return _type;} void set_type(const TString& type) {_type = type;} const TString& row(int pos) const;//ritorna il campo dell'array della posizione + TString& row(int pos); void add(const TString& c, int pos = -1);//scrive il campo nell'array alla posizione const int items() const {return _array.items();}//ritorna il numero di elementi dell'array virtual bool destroy(int index = -1, bool pack = FALSE) {return _array.destroy(index, pack);}