Recent

Author Topic: Troubles assigning a file  (Read 6917 times)

Dhouard

  • Guest
Troubles assigning a file
« on: December 10, 2003, 10:19:45 am »
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

  • New Member
  • *
  • Posts: 25
Troubles assigning a file
« Reply #1 on: December 10, 2003, 10:25:53 am »
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.

 

TinyPortal © 2005-2018