home *** CD-ROM | disk | FTP | other *** search
/ synchro.net / synchro.net.tar / synchro.net / main / BBS / OPXSPEC1.ZIP / example1.pas next >
Encoding:
Pascal/Delphi Source File  |  1996-04-03  |  1.2 KB  |  60 lines

  1. (* Example #1
  2.  
  3.   Search for a particular Conference and display the TO field for
  4.   each message in the conference.
  5.  
  6. *)
  7.  
  8. Uses FidoFmt,
  9.      OpxLib;
  10.  
  11. Var fvx  : file of TMailIdxType;
  12.     fv   : file;
  13.     mx   : TMailIdxType;
  14.     mh   : TMailHdrType;
  15.     mhdr : TFidoMsgType;
  16.     w    : integer;
  17.  
  18. Const
  19.     SearchArea  : word = 10;
  20.  
  21. begin
  22.  
  23.   assign(fvx,'mail.idx');
  24.   reset(fvx);
  25.  
  26.   assign(fv,'mail.dat');
  27.   reset(fv,1);
  28.  
  29.   while not eof(fvx) do
  30.      begin
  31.        read(fvx,mx);
  32.        if mx.area = SearchArea then
  33.           begin
  34.             writeln('Conference area : ',mx.area);
  35.             seek(fv,mx.fpos);
  36.             while not eof(fv) do
  37.                begin
  38.                  (* read mail.dat header, double check conference # *)
  39.  
  40.                  blockread(fv,mh,sizeof(mh),w);
  41.                  if mh.iarea <> SearchArea then break;
  42.  
  43.                  (* read message header *)
  44.  
  45.                  blockread(fv,mhdr,sizeof(mhdr),w);
  46.                  writeln('TO : ',Mhdr.ToWhom);
  47.  
  48.                  (* go to next header *)
  49.                  seek(fv,filepos(fv)+mh.fsize-sizeof(mhdr));
  50.  
  51.                end;
  52.             break;
  53.           end;
  54.      end;
  55.  
  56.   close(fv);
  57.   close(fvx);
  58.  
  59. end.
  60.