home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / blx21.zip / OV2DLL.ARJ / TXTDLL.PAS < prev   
Pascal/Delphi Source File  |  1992-05-28  |  794b  |  38 lines

  1. Library TxtDLL;
  2.  
  3. uses Strings, WinProcs, WinTypes;
  4.  
  5. function GetAString(FileName: PChar; Buffer:PChar): PChar;  export;
  6. var
  7.   f: file;
  8.   SizeOfFile: integer;
  9.   Buf: array[0..4095] of byte;
  10. begin
  11.   assign(f, filename);
  12.   {$I-}
  13.   reset(f,1);
  14.   {$I+}
  15.   if IOResult <> 0 then
  16.   begin
  17.     GetAString:=#0;;
  18.     Exit;
  19.   end;
  20.   SizeOfFile := filesize(f);
  21.   {$I-} {I/O Checking off}
  22.   BlockRead(f, buf, 4095);
  23.   {$I+} {I/O Checking on}
  24.   if IOResult<>0 then; {Dump any IO error}
  25.   if SizeOfFile<4095 then
  26.     Buf[SizeOfFile]:=0
  27.   else
  28.     buf[4095]:=0;
  29.   Close(f);
  30.   StrCopy(buffer,@buf);  { copy the stored value into the passed buf parameter }
  31.   GetAString := buffer;     { pass the value as a return value as well }
  32. end;
  33.  
  34. exports GetAString index 1;
  35.  
  36. begin
  37. end.
  38.