I don't get it. I am working on a program in which i'd like to save a list of classes to a file, and later on read them again. I am doing something wrong but i dont know what. The code below is an example of what i want to do. When i compile the whole code everything seems to go well, but when i exclude the code between the 2 lines i get an acces violation or some other fault. I dont know if i am doing something wrong writing of reading of both. Can somebody please help with this problem, i have been trying to figure it out for a long time but can get it to work.
Thnx

#include <fstream.h>
#include <string>
using namespace std;

class Word
{
public:
void SetWord(string woord) { str = woord; };
string GetWord() const { return str; };
private:
string str;
};

int main()
{
//---------------------------------------------------------------------
Word * pWrd = new Word;
pWrd->SetWord("It works");

ofstream fout("test.bin", ios::binary | ios::out | ios::trunc);
fout.write((char*) pWrd, sizeof (*pWrd));
fout.close();
//---------------------------------------------------------------------
Word * uWrd = new Word;
ifstream fin("test.bin", ios::binary | ios::in);
fin.read((char*) uWrd, sizeof (*uWrd));

cout << uWrd->GetWord() << endl;

fin.close();
return NULL;
}