Re: ifstream under NT

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Thu Dec 02 1999 - 02:36:37 MET


----- Original Message -----
From: Anton Fokin <dr_mamadu@mail.ru>
To: <roottalk@pcroot.cern.ch>

Subject: ifstream under NT


> Hi rooters,
> I have just faced a problem, which is a kind of well known (from roottalk refs.) but it is still an enigma for me. The
following works just fine under sun solaris but crashes under NT with diagnostics:
>
> Fatal in <operator delete>: storage area overwritten
> aborting
> Warning in <TWinNTSystem::StackTrace>: this method must be overridden!
>
> void
> TFileDataSource::Update()
> {
>   if (!fIsUpdated) {
>     printf("Loadnig data ...\n");
>     ifstream ifs(fFileName.Data());
>     Int_t    date;
>     Float_t  price;
>     while (!ifs.eof()) {
>       ifs >> date >> price;
>       fAsset->AddPriceData(TDate(date,"yymmdd"),price);
>     }
>     ifs.close();
>     fIsUpdated = kTRUE;
>   }
> }

I could not to reproduce your problem with a macro as follows:

#include "iostream.h"
TString fFileName = "Anton.C";
Bool_t fIsUpdated = kFALSE;
void Anton()
{
  if (!fIsUpdated) {
    printf("Loading data ...\n");
    ifstream ifs(fFileName.Data());
    Int_t    date;
    Float_t  price;
    while (!ifs.eof()) {
      ifs >> date >> price;
 //     fAsset->AddPriceData(TDate(date,"yymmdd"),price);
        cout << date << ":" << price << endl;
    }
    ifs.close();
    fIsUpdated = kTRUE;
  }
}

It works.
                    Valery



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:43 MET