Click to See Complete Forum and Search --> : streams


Kohinoor24
October 1st, 2002, 04:46 AM
Iam writing Data into a stream of type Ofstream.

WriteData() is a function for writing datas.

c_stream
is a class having the private member
ofstream m_stream;

WriteData() Can be acceesed more than once depending on the objects to be written.
m_drawer is a pointer to a class which gives me the c_stream pointer.So Iam creating the c_stream only once.
When Iam writing object for the second time,ie: when Iam accessing WriteData() func for the second time.
m_stream.tellp() shows me 0. why?.how can I solve it.

It works fine when I make the m_stream a static variable.

void WriteData()
{
if(!stream)
{
c_sream *m_pData = new C_stream();
m_drawer.Storestream(*m_pData);
}
else
c_stream *md = m_drawer.Getstream();
}

Thanks in advance...