Dear List.

I was trying to use the ini file for our program to store a single space " " as a value, but this does not seem to be posible.

From the Wikipedia definition of INI file (https://en.wikipedia.org/wiki/INI_file#Whitespace) whitespace in values does not seem to be well defined, so it may just be a design choice.

The following illustrates the issue:

program Project1;

{$mode objfpc}{$H+}

uses
  Classes, IniFiles;

var
  Ini: TIniFile;
  S: String;
begin
  Ini := TIniFile.Create('/tmp/test.ini');
  Ini.WriteString('sec1', 'S', ' ');
  Ini.Free;

  Ini := TIniFile.Create('/tmp/test.ini');
S := Ini.ReadString('sec1', 'S', 'ZZ'); // S is '' and not ' ' as expected
  Ini.Free;
end.


Is this considered a bug or "by design"?

Kind regards
Torsten Bonde Christiansen
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to