Thanks everyone for the help. I have it working now
I did some more searching and found out I can get "Try" to work with {$Mode TP}
If I add {$Modeswitch exceptions} and appearantly {$R+} to make sure range
checking is on.
So I have it working in my {$Mode TP} Unit.
_
On Thu, 29 Apr 2021, James Richters via fpc-pascal wrote:
Best add SysUtils and Classes.
Thanks, that worked. But now I'm getting "cannot read or write variables of this
type" for Writeln(Exception) is there an easy way to find out what the exception is?
On E : Exception do
Writeln(
>Best add SysUtils and Classes.
Thanks, that worked. But now I'm getting "cannot read or write variables of
this type" for Writeln(Exception) is there an easy way to find out what the
exception is?
James
___
fpc-pascal maillist - fpc-pascal@list
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’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');
e
James Richters schrieb am Do.,
29. Apr. 2021, 10:33:
> I get Error: Identifier not found “Try”
>
> Because my unit must be compiled with {$MODE TP}
>
You can try to use {$modeswitch exceptions}, I think.
Otherwise quite a few procedures and functions won’t even compile that only
> work in Turbo
I get Error: Identifier not found “Try”
Because my unit must be compiled with {$MODE TP}
Otherwise quite a few procedures and functions won’t even compile that only
work in Turbo Pascal mode.
I guess I can put it in another unit and make a call to that… then I can use Try
Thanks for the inform
James Richters via fpc-pascal schrieb am
Do., 29. Apr. 2021, 03:13:
> {$i-}
>
> Log_Ini := TIniFile.Create(‘my.ini’); // blows up with 217
>
> Writeln(ioresult);
>
> {$i+}
>
>
>
> The error I get is:
>
> An unhandled exception occurred at $005A57D0:
>
> EFOpenError: Unable to open file "LOG.INI
I'm trying to detect if an INI file is open by another program, but the way
I normally do this is not working.
// open the file for write and keep it open to test
Assign(myfile,'my.ini');
Rewrite(myfile);
{$i-}
Assign(myfile2, 'my.ini';
Rewrite(myfile2);//try to open it for write again
Wr