www.digitalmars.com         C & C++   DMDScript  

c++ - fstreams

Hello.

I seem to have some sort of problem where I would get an io error writing to
formatted fstreams.

I was writing statistical counters to a disk file where I was writing them
something like:

assume Out is an fstream opened: Out.open(Name,ios::out|ios::app);

Out<<Date<<";"<<Cell
hh   = 0;
ii   = 0;
nn   = Obj.GetNumberOfCounters();
ierr = 0;
while((hh < 24) && (ierr == 0)) {
while((ii < nn) && (ierr == 0)) {
Out<<";"<<Obj.GetCounterValue(ii,hh);
ierr = Out.rdstate();
ii++;
}
Out<<endl;
ierr = Out.rdstate();
hh++
}

When I tried to debug it...the moment I put in break points...it seemed to cause
crash...and then it seemed that if I moved the break-points...it moved the
crash...so I resorted to cout statements tracing the logic...

I gave up...I changed the code to where I write the results of the ith counter
for the hour to a text string and then write out the text string one line at a
time...

If there something known that I'm fundamentally doing wrong?

Thank you...

fstream write error
Nov 09 2005