XSharpPublic icon indicating copy to clipboard operation
XSharpPublic copied to clipboard

FOPen(tcFName, nAttribute) probably different Attribute

Open lazy-fox opened this issue 5 years ago • 1 comments

This is NOT a verified bug, but a hunch from reading docs. I was reading Wolfgangs StringBuilder Post, wanted to add vfp similarities, including hint to pipe Unix-like into buffered LLF. Wondered, why the harder versions like creating a C buffer plus memcpy was already in thread and not simple write to buffered file, looked up FOpen in XIde docs and read: kMode Type: UInt32 The DOS open mode, which determines the accessibility of the file. The open mode is composed of elements from the two types of modes: Access mode + Sharing mode. Specifying an access mode constant indicates how the opened file is to be accessed; the sharing mode determines how other processes can access the file.
Available open and sharing mode constants are listed below: Access Modes Operation FO_READ Open for reading (default) FO_READWRITE Open for reading or writing FO_WRITE Open for writing

Sharing Modes Operation FO_COMPAT Compatibility mode (default) FO_DENYNONE Allow others to read or write FO_DENYREAD Prevent others from reading FO_DENYWRITE Prevent others from writing FO_EXCLUSIVE Exclusive use FO_SHARED Same as FO_DENYNONE The default open mode is non-sharable and read-only. If just the access mode is used, the file is opened as non-sharable.

vfp docs describe:

nAttribute Read/Write privileges Buffered/unbuffered
0 (Default) Read-only Buffered
1 Write-only Buffered
2 Read and Write Buffered
10 Read-only Unbuffered
11 Write-only Unbuffered
12 Read and Write Unbuffered

range 0..2 is identical insofar as read/write/R&W is concerned, no idea if/how xSharp opens with or without buffers. As said, not really tested, (11 does return bytes as written) but unclear if 0..2 buffered vs 10..12 unbuffered is reflected in xSharp, because I did not find other FO_CONSTANTS below 16 documented or any specific HEX jumped at me in File.Prg on quick glance, but I did not look hard, as creator probably knows without looking...

regards thomas

lazy-fox avatar Mar 15 '20 13:03 lazy-fox

Thomas, Can you describe the differences in VFP between Buffered and Non buffered ?

RobertvanderHulst avatar Mar 27 '20 11:03 RobertvanderHulst