Ä Fido Pascal Conference ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ PASCAL Ä Msg : 61 of 322 From : Cees Binkhorst 2:500/137.2193 01 Jun 93 21:55 To : John Fulton Subj : FileMode? ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Hi John, In a message of to All (), you wrote: JF> Could someone post all the different File Modes availl with FileMode, and JF> a short descript of each one? One liners are fine. Just enough so I can JF> figure them out. Some time ago I prepared the following for my own use: A. Dos supports two methods of working with files. 1. Through the File Control Block (FCB) structure a) only workable in versions 1.0 and later 2. Through the use of filehandles a) works only from version 2.0 1) the access mode can be a> 0 = read only b> 1 = write only c> 2 = read and write b) Version 3.0 and later support sharing of files: 1) Access mode (merge with sharing mode) Action of process that opens file a> xxxx 0000 = $00 - read only b> xxxx 0001 = $01 - write only c> xxxx 0010 = $02 - read+write d> xxxx 0011 = $03 = Reserved 2) Sharing mode (merge with access mode) Possible actions of other process on same file a> 0000 xxxx = $00 + xxxx - compatibility mode 1> only process that opens file can access it b> 0001 xxxx = $20 + xxxx - deny write c> 0011 xxxx = $30 + xxxx - deny read d> 0100 xxxx = $40 + xxxx - deny none 3) Other a> 1000 0000 = inheritance flag 1> if set child process (EXEC int 21H 4BH) will not inherit sharing mode B. Filemodes with TP variable 'FileMode' in System unit take only effect after 'Reset' of file. Dos will not allow a file opened with 'Rewrite' to have a sharing method. Therefore create file with 'Rewrite', 'Close' it and immediately reopen it with 'Reset'. Default value of Filemode = $2 in TP. C. Record locking is possible in version 3.3 and later. 1. It uses interrupt 21 function 5CH as follows: a) AH 5CH b) AL 00H = lock region 01H = unlock region c) BX handle d) CX high part of region offset e) DX low part of region offset f) SI high part of region length g) DI low part of region length h) on return 1) successful - Carry flag clear 2) not successful - Carry flag set and error code in AX a> error code 01H incorrect function b> error code 02H incorrect handle c> error code 03H lock-status incorrect 2. Interrupt 21H function 44H sets the sharing retry count a) AH 44H b) AL 0BH c) CX delays per retry (default = 1) d) DX number of retries (default = 3) 3. Child process (EXEC int 21H 4BH) inherits handles but not active locks 4. Duplicate handles (int 21H 45H) or redirected handles (int 21H 46H) are allowed access to locked regions within the same process. I think this covers what you want. Cees --- The-Box Edit 1.10- PC * Origin: House of Glass (2:500/137.2193)