Could be.

-----Original Message-----
From: fpc-pascal-boun...@lists.freepascal.org
[mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of Mattias
Gaertner
Sent: Sunday, March 1, 2015 7:52 AM
To: fpc-pascal@lists.freepascal.org
Subject: [fpc-pascal] the unexplained 666

Hi,

Today I stumbled (again) over TFileStream and it contains the constant
438:

constructor TFileStream.Create(const AFileName: string; Mode: Word);

begin
  Create(AFileName,Mode,438);
end;

You need several searches to find out what the 438 actually is.

For example its fpdoc page does not explains it:
http://lazarus-ccr.sourceforge.net/docs/rtl/classes/tfilestream.create.html

Same for the called FileCreate:
http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/filecreate.html

Under Windows the Rights are not used.
Under Unix it calls fpOpen, which only tells about "permissions":
http://lazarus-ccr.sourceforge.net/docs/rtl/baseunix/fpopen.html

Then it calls 'FPC_SYSC_OPEN', which under Linux calls syscall 'open', which
after a search reveals, that the mode is a bit field using the
S_I* constants, which are usually written in binary, octal or hexadecimal.

The octal value of 438 is &666, which is read/write permissions for
other/group/owner.

Why not write &666? Maybe some religious reasons? ;)

Mattias
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to