Hello, James!
I found an error at GetMem / ReAllocMem: Your code:
getMem(tmpStrings, 100);
{reAllocMem(tmpStrings, (I + 1));}
reserves 100 or (I + 1) BYTES, but you need space for 100 or (I + 1) STRINGS, i. e. the code should be:
getMem(tmpStrings, SizeOf(String) * 100);
{reAllocMem(tmpStrings, SizeOf(String) * (I + 1));}
Even then, I don't know if fpc behaves correctly converning deallocation when <String> defaults to <AnsiString>. Maybe somebody else can respond to this?
Another note: Please replace tabulators by spaces when posting code.
Hope this Helps.
Anton Tichawa.
you wrote 18 lines
Hi all,
Sorry if this is trivial, but I'm sick of it :)
I'm using fpc to convert my (originally delphi) code to read and write
ini style files, however writing will not work as I want, the data in
the pointer keeps getting filled with junk.
I'm using getMem, and reAllocMem functions to create dynamic arrays of
strings. The writeINI function reads the entire file in, but doesn't
even do that correctly.
I have a test program that uses the same idea, and it works perfectly,
so I'm very bewildered :(
attached is the code if someone would like to have a look at it, please.
thank you
James
----------
"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte Berechnungen einzuweben."
Doris Langley Moore: Ada, Countess of Lovelace (London 1977).
----------
Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email:
----------