[fpc-pascal] Detecting IO errors with INI file

Michael Van Canneyt michael at freepascal.org
Thu Apr 29 13:08:12 CEST 2021



On Thu, 29 Apr 2021, James Richters via fpc-pascal wrote:

> I’m trying to put the Ini file stuff all in it’s own unit.
>
> My unit is {$Mode OBJFPC}
> and Uses IniFiles;
>
> “Try”  is compiling, but I’m getting Error: Identifier not found “EFOpenError”
>
> And also Syntax error “Do” expected but “)” found
>
> I have:
>
> try
>  Log_ini := TIniFile.Create('myini.ini');
> except
>  on e: EFOpenError do      // Identifier not found “EFOPenError”
>    Writeln(EFOpenError);
>  on e: Exception do
>    Writeln(Exception);
> end;
>
> Do I need some other unit for EFOpenError to work?

Best add SysUtils and Classes.

Michael.


More information about the fpc-pascal mailing list