[Lazarus-es] Problema con archivos

Hetor S. Ponce hectorsponce en gmail.com
Jue Oct 29 04:30:13 CET 2009


acabo de solucionarlo:

en otra parte de mi codigo preguntaba:

if not eof then
begin

end;

cuando deberia haber sido

if not qry.eof then
begin

end;

no se por que el ompilador daba error dentro de la función
get_firstline()....


muchas gracias



JoshyFun escribió:
> Hello Hetor,
>
> Wednesday, October 28, 2009, 11:58:08 PM, you wrote:
>
> HSP> En el codigo:        ReadLn(f, s);     // aca da el error*
>
> [...]
>
> Prueba cambiando esto:
>
>    Function get_firstline(fname: string): string;
>    var
>      f: TextFile;
>      s: String;
>    begin
>      if FileExists(fname) then
>      begin
>        AssignFile(f, fname);
>        Reset(f);
>
>        ReadLn(f, s);     // aca da el error
>
>        result:=s;
>        CloseFile(f);
>      end;
>    end;
>
> por esto otro:
>
>    Function get_firstline(fname: string): string;
>    var
>      fi: TextFile;
>      si: String;
>    begin
>      if FileExists(fname) then
>      begin
>        AssignFile(fi, fname);
>        Reset(fi);
>
>        ReadLn(fi, si);     // aca da el error
>
>        result:=si;
>        CloseFile(fi);
>      end;
>    end;
>
> Si así funciona por favor avisa por que sería un bug y comprobaría si
> está corregido en fpc 2.5.1
>
>   





More information about the Lazarus-es mailing list