I have a code which goes like this.I want to store an object in a poinetr of the corr: class & want to retrieve it later.

I tied this code,but it is not working




#include<fstream>
using namespace std;

typedef short T_16bit;
typedef int T_32bit;

const char cCc ={'\x5A'};
const char Length [] = {'\x00','\x00'};
const char IDM[] = {'\xD3','\xAB','\xCA','\x00','\x00','\x00'} ;


class C_ptx

{
public:
C_ptx()
{
m_ptx.open("First",ios:ut|ios::binary);
}

void Createstream()
{
m_ptx.write(&cCc,sizeof(cCc));
// m_ptx.write(Length,sizeof(Length));
m_ptx.write(IDM,sizeof(IDM));

}
ofstream& returnstream()
{
return m_ptx;

}

private:
ofstream m_ptx;

};



class space
{

public:
void store(C_ptx &object)
{
*m_ptx = object;
}

C_ptx* retrieve()
{
return m_ptx;
}

private:

C_ptx *m_ptx;

};

void main()
{
C_ptx *p = new C_ptx;
p->Createstream ();
space s1;
//When I call here it shows unhandled exception
s1.store(*p);

}

Kohinoor