[fpc-pascal] FileOpen and share on MacOSX

Bent Normann Olsen bent at earmaster.com
Tue Apr 1 13:58:00 CEST 2008


Hi,

In unix/sysutils.pp on FPC for MacOSX you'll find FileOpen which only
supports flags for fmOpenRead, fmOpenWrite, and fmOpenReadWrite.

Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
Var LinuxFlags : longint;
BEGIN
  LinuxFlags:=0;
  Case (Mode and 3) of
    0 : LinuxFlags:=LinuxFlags or O_RdOnly;
    1 : LinuxFlags:=LinuxFlags or O_WrOnly;
    2 : LinuxFlags:=LinuxFlags or O_RdWr;
  end;
  FileOpen:=fpOpen (FileName,LinuxFlags);
  //!! We need to set locking based on Mode !!
end;


Does anybody have experience sharing files on MacOSX and knows which flags
goes with fmShareDenyWrite and fmShareDenyNone for fpOpen?

TIA,
Normann




More information about the fpc-pascal mailing list