www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.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