Recent

Author Topic: ReadLn problem Newbie Question  (Read 5908 times)

Chief1Oar

  • Newbie
  • Posts: 6
ReadLn problem Newbie Question
« on: March 31, 2011, 11:27:09 pm »
Hello everyone, I am new to Pascal and I am trying to write a dll that reads lines of text from a text file. I have Assigned the file and path.

When I compile I get the following error...

Error: Incompatible types: got "untyped" expected "AnsiString"

the code:
//-----------------
library TestLib;

{$mode objfpc} {$H+}

uses

  sysutils, Dialogs;

var
  filhand:   text;
  fPathNam: string;
//---------         ----------------//         
function ReadInputFile(): string; stdcall;
var
   instring: ansistring;
begin
   if not Eof(filhand) then
         result := ReadLn(filhand,instring)   //error points to this line     
     else
        result := 'EOF';
end;
exports
      ReadInputFile;       

Can someone please tell me what I am doing wrong.. (I know it's got to be simple  ;)  )

Thank you
Chief     

eny

  • Hero Member
  • *****
  • Posts: 1634
Re: ReadLn problem Newbie Question
« Reply #1 on: April 01, 2011, 12:20:04 am »
When did ReadLn change into a function?

Code: Pascal  [Select][+][-]
  1.   //...
  2.   ReadLn(filhand,result)
  3.   //...
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

Chief1Oar

  • Newbie
  • Posts: 6
Re: ReadLn problem Newbie Question
« Reply #2 on: April 01, 2011, 03:20:42 am »
 :-[  Our own stupidity can be amazingly brutal at times...

Thank you for the help... :)

 

TinyPortal © 2005-2018