home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / t / tcsel003.zip / FILESTR.PAS < prev    next >
Pascal/Delphi Source File  |  1992-10-16  |  1KB  |  58 lines

  1. {$B-,D-,F-,I-,L-,N-,O-,R-,S-,V-}
  2.  
  3. unit filestr;
  4.  
  5. interface
  6.  
  7. uses dos;
  8.  
  9. function GetFstr(var f: text): string;
  10. procedure OpenFStr(var f: text);
  11.  
  12. implementation
  13.  
  14. var
  15.   FStrBuff     : string;
  16.  
  17. function GetFStr(var f: text): string;
  18.   begin
  19.     GetFStr     := FStrBuff;
  20.     FStrBuff[0] := #0;
  21.     TextRec(f).BufPos := 0;
  22.   end; { GetFStr }
  23.   
  24. {$F+}
  25. function FStrOpen(var f: TextRec):word;
  26.   { This does nothing except return zero to indicate success }
  27.   begin
  28.     FStrOpen := 0;
  29.   end; { FStrOpen }
  30.   
  31. function FStrInOut(var f: TextRec):word;
  32.   begin
  33.     FStrBuff[0] := chr(F.BufPos);  
  34.     FStrInOut   := 0;
  35.   end; { FStrInOut }  
  36. {$F-}
  37.  
  38. procedure OpenFStr(var f: text);
  39.   begin
  40.     with TextRec(f) do begin
  41.       mode      := fmClosed;
  42.       BufSize   := Sizeof(buffer);
  43.       OpenFunc  := @FStrOpen;
  44.       InOutFunc := @FStrInOut;
  45.       FlushFunc := @FStrInOut;
  46.       CloseFunc := @FStrOpen;
  47.       BufPos    := 0;
  48.       BufEnd    := 0;
  49.       BufPtr    := @FStrBuff[1];
  50.       Name[0]   := #0;
  51.     end; { with }
  52.     FStrBuff[0] := #0;
  53.     rewrite(f);
  54.   end;  { AssignFStr }   
  55.  
  56.  
  57. end.  
  58.