Forum > General

Troubles assigning a file

(1/1)

Dhouard:
I have a very strange problem when compiling a little program from inside lazarus. whenever I try to assign a name to a file using the command "assign" I have an "wrong amount of parameters especified" error.

I try to compile a programme like this on fpc (console) y worked. There was no problem, but the same code inside lazarus gives the error.

Here's the code.

---

procedure TForm1.Button4Click(Sender: TObject);
 
   Var
      F: file;

   begin
      Assign(F, 'pepe.txt');
   end;

---

what can it be happening?

Thanks.
Dhouard.

vrs:
The TForm class is derived from TPersistant, which has an assign method. The compiler thinks you want to use that mehod.

To use the assign procedure to assign a file add the unit name where it can be found.

System.Assign(F,'pepe.txt') will do the trick.

Vincent.

Navigation

[0] Message Index

Go to full version