[fpc-pascal] TIniFile: how to save bool as string?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Sat Oct 4 12:08:20 CEST 2014


Reinier Olislagers wrote:
> On 03/10/2014 21:16, silvioprog wrote:> When I use the TIniFile to save my configurations, it saves the boolean> values as 0 and 1.> > Is there any way to save these values as string (true/false) instead> of integer (0/1)? If not, can I send a patch to implement that?!
> 1. Write your own wrapper?2. AFAIR, there already is a bug report+patch in the bug tracker onextending TInifiles.

At least if it saves (and presumably expects) 0 and 1 it's protected 
from internationalisation issues e.g. if a template .ini is supplied 
with an app.

I hacked a wrapper some while ago for my own use, which tries to 
preserve the form of the variable (i.e. if it's currently "True" then 
"False" is written, but if it's "yes" then "no" is written"). That's 
obviously massively problematic if multiple languages have to be supported.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list