home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / top2src.zip / TOPLINK.ZIP / TOPTEST.PAS < prev    next >
Pascal/Delphi Source File  |  1994-06-03  |  2KB  |  86 lines

  1. Program RAPLink;
  2.  
  3. Const
  4.    fmReadOnly  = $00;  (* *)
  5.    fmWriteOnly = $01;  (* Only one of these should be used *)
  6.    fmReadWrite = $02;  (* *)
  7.  
  8.    fmDenyAll   = $10;  (* together With only one of these  *)
  9.    fmDenyWrite = $20;  (* *)
  10.    fmDenyRead  = $30;  (* *)
  11.    fmDenyNone  = $40;  (* *)
  12.  
  13. Type
  14.   RAPRec = Record
  15.              Buf : Array [1..8] of byte;
  16.              Alias : String[30];
  17.              Data : String[245];
  18.            end;
  19.  
  20. Var
  21.   RAPFile : File of RAPRec;
  22.   RAPBlock : RAPRec;
  23.  
  24. Procedure WriteCString (var str; len : byte);
  25. Var
  26.   s : string absolute str;
  27.   l : byte;
  28. begin
  29.   l := 0;
  30.   While (s[l] <> #0) and (l <= len) do
  31.   begin
  32.     Write (s[l]);
  33.     Inc (l);
  34.   end;
  35.   Writeln;
  36. end;
  37.  
  38. Var
  39.   L : byte;
  40.   F : File of byte;
  41.  
  42. begin
  43.   FileMode:=fmReadWrite+FmDenyNone;
  44.   Writeln (SizeOf (RAPBlock));
  45.   Assign (RAPFile, 'd:\node001.rap');
  46.   Reset (RAPFile);
  47. {  Read (RAPFile, RAPBlock);
  48.   Close (RAPFIle);
  49.   WriteCString (RAPBlock.Alias,28);
  50.   For L := 1 to 5 do Write (Ord(RAPBlock.Data[L]):5);
  51.   Writeln;
  52.   WriteCString (RAPBlock.Data,255);}
  53.   RAPBlock.Buf[1] := 25;
  54.   RAPBlock.Buf[2] := 0;
  55.   RAPBlock.Buf[3] := 0;
  56.   RAPBlock.Buf[4] := 0;
  57.   RAPBlock.Buf[5] := $00;
  58.   RAPBlock.Buf[6] := $00;
  59.   RAPBlock.Buf[7] := 0;
  60.   RAPBlock.Buf[8] := 0;
  61.   RAPBlock.Alias := 'APLink'#0;
  62.   RAPBlock.Alias[0] := 'R';
  63.   RAPBlock.Data := 'est message'#0;
  64.   RAPBlock.Data[0] := 'T';
  65.   Write (RAPFile, RAPBlock);
  66.   Close (RAPFile);
  67.   Assign (f, 'D:\MIDX001.RAP');
  68.   Reset (f);
  69.   L := 1;
  70.   {$I-}
  71.   Repeat
  72.     Write (f,l);
  73.   Until IOResult = 0;
  74.   {$I+}
  75.   Close (f);
  76.   Assign (f, 'D:\CHGIDX.RAP');
  77.   Reset (f);
  78.   L := 1;
  79.   {$I-}
  80.   Repeat
  81.     Write (f,l);
  82.   Until IOResult = 0;
  83.   {$I+}
  84.   Close (f);
  85. end.
  86.