Thank you!!
Regards
-----Mensaje original-----
De: Mattias Gaertner [mailto:[EMAIL PROTECTED]
Enviado el: martes, 17 de julio de 2007 07:07 p.m.
Para: [email protected]
Asunto: Re: [lazarus] Problem with file
On Tue, 17 Jul 2007 18:49:35 -0300
"German C. Basisty" <[EMAIL PROTECTED]> wrote:
> Hello again!
>
>
>
> I wrote this simple program in pascal on my Linux box:
>
>
>
> ==================================
>
> program exists;
>
>
>
> var
>
> f: file of string;
>
> IOR: integer;
>
>
>
> begin
>
> assign(f, 'test.txt');
>
> {$I-}
>
> reset(f);
>
> {$I+}
>
> IOR := IOResult;
>
> if IOR = 2 then
>
> writeln('exists')
>
> else if IOR = 0 then
>
> writeln('it does not exists')
>
> else if IOR <> 0 then
>
> halt;
>
> close(f);
>
> end.
>
> ==================================
>
>
>
> # fpc exists.pas
>
>
>
> It Works fine. Now I'm writting an app with lazarus, and the same code
> (inside a procedure) does not work. An error message appears when
> compiling:
>
>
>
> Unit1.pas(50,30) Error: Wrong number of parameters specified
>
>
>
> Should I handle files with lazarus in a diferent way tan with fpc?
No. Lazarus uses plain FPC. It does not mangle your code.
But 'assign' and 'close' are methods of your TForm, and they expect
other parameters.
You can see this yourself, by using the 'find declaration'feature of
lazarus.
The 'assign' you want to use is in the 'system' unit, so
you can write 'System.Assign' and 'System.Close' to tell the compiler
to use the right function.
Or you can use the FileExists and/or FileIsReadable function of the
FileUtil unit.
Mattias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives