Forum > General

Troubles assigning a file


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);
      F: file;

      Assign(F, 'pepe.txt');


what can it be happening?


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.



[0] Message Index

Go to full version