Forum > General
Land of Confusion
Trunkles:
Hi all.
Here's the code.
--- Code: ---Procedure TTail.DoTheTail;
var
InFile, Outfile: Text;
TextRead: array of String;
TextLine: String;
i: integer;
begin
// Set the size of TextRead;
SetLength(TextRead, LineCount);
// Open the two files
Assign(InFile, '');
...
--- End code ---
And the compiler tells me...
--- Code: ---Error: Wrong number of parameters specified for call to "Assign"
--- End code ---
Er... From what I can see in rtl help one of the overloaded versions of assign() is...
--- Code: ---procedure Assign(
out t: Text;
const s: String
);
--- End code ---
So, folks, what the $^&*&%* have I misunderstood?
Simon.
cdbc:
Hi
--- Code: ---Procedure TTail.DoTheTail;
var
InFile: Text;
TextRead: array of String;
TextLine: String;
i: integer;
begin
assign(InFile,'TailData.txt'); { assign filename to filehandle }
try
reset(InFIle); { open file for reading }
I:= 0;
while not EOF(InFile) do begin
readln(InFile,TextLine); { read one line at the time }
SetLength(TextRead,I+1); { reallocate buffer array }
TextRead[I]:= TextLine;
inc(I); { increment linecounter }
end;
...
{ process buffer array }
...
except on E:Exception do
writeLOG('Error opening file: '+E.Message); { just in case }
end;
close(InFile);
end;
{ Tip:
var List: TStrings;
begin
List:= TStringList.Create;
List.Loadfromfile('TailData.txt');
{ process listdata }
List.Free;
end; }
--- End code ---
hth
Regards - Benny
Trunkles:
But that's what I've got in my code! I get the same error whether the file name is a null string or a value picked of the command line (It's a console app).
cdbc:
Hi
My bad...
system.assign
hth Regards Benny
Trunkles:
Now I understand. :D
Thanks Benny, it all makes sense now.
Navigation
[0] Message Index
[#] Next page