TIdMessage.SaveToFile access violation

Giganews Newsgroups
Subject: TIdMessage.SaveToFile access violation
Posted by:  Feij√≥ (fei…@x.suply.com)
Date: Thu, 2 Dec 2004

I dont belive I have any problems on my code:

        msg := TIdMessage.Create(Self);
        Retrieve(m, msg);
        fname := Format('msgs\%s.eml', [FormatDateTime('yymmdd-hhnnss',
Now)]);
        msg.SaveToFile(fname);

the SaveToFile raises an Access Violation, here its code from Indy source:

  vStream := TFileStream.create(AFileName, fmCreate);
  try
    SaveToStream(vStream, AHeadersOnly);
  finally
    vStream.Free;
  end;

the error is caused buy the vStream.Free line

Dont wanna change Indy source, what should I do ?

The file is created correctly

regards
Feijó

Replies