I have developed a small address database using a listbox. The addresses are stored in a text file with each entry on a new line (name, address postal code, town, empty line) to be easy to read and edit manually.
It works perfectly on my osx mac, but when I compile and run it on windows and use a file saved on my mac, the empty lines added by t.writeline () are skipped for some reason. If I save on the windowsPC, then it opens fine on both win and osx. I am opening the file as UTF-8.
The weird thing is that if I replace t.writeline () with t.writeline(ListBox1.Cell (0,0))
Then the extra line is not skipped and it works, but I would like the empty line in the file!
I also tried to replace with t.writeline str("") and a bunch of other fun, but without result.
Of course I could add an empty listbox cell as a work around, but I would like to know what is going on.
(-Something with LF/CR?? -If so, what should I do?)
What am I doing wrong? Am I not automatically writing utf-8? Does utf-8 not cure the LF/CR compatibillity issues?
…
if f <> nil then
t=TextOutputStream.Create(f)
for d=1 to c
t.writeline(ListBox1.Cell (a,b))
b=b+1
t.writeline(ListBox1.Cell (a,b))
b=b+1
t.writeline(ListBox1.Cell (a,b))
b=b+1
t.writeline(ListBox1.Cell (a,b))
t.writeline () 'to separate entriies with empty line in the file (osx saved file does not work on win)
'Replacing with t.writeline(ListBox1.Cell (0,0)) works but adds junk
b=b-3
a=a+1
next d
t.close