ugogan@ecsvax.UUCP (Jim Gogan) (03/17/87)
Has anyone found a way to get Turbo Pascal to open random access files in read only mode to allow shared concurrent access over an MS-DOS 3.1/NETBIOS-based network? Normally, Turbo opens files in read/write mode only, producing "sharing violation ... abort, retry, ignore" error messages. (At least the version of Turbo we have does.) We could trap those errors & have users wait till file is free, but would obviously prefer shared access. Thoughts, anyone?? -- Jim Gogan (ugogan@ecsvax) Microcomputing Support Center University of North Carolina at Chapel Hill -- Jim Gogan mail:ugogan@ecsvax (UUCP/BITNET) Microcomputing Support Center University of North Carolina at Chapel Hill Chapel Hill, NC 27514
bass@ecsvax.UUCP (Jeff Bass) (03/19/87)
I also had a "read only" problem with TURBO Pascal. I was using open and reset with the $I- option to detect whether a file existed or not. I got errors as expected when the filename opened did not exist. I was surprised to find that I got the same error if the file was marked read-only (as can be done with various attribute diddling utilites). In other words, TURBO cannot open a read only file for read only. Hmmm... Jeff Bass BASS Institute Inc., P O Box 349, Chapel Hill, NC 27514 bass@ecsvax
davidr@hplsla.UUCP (03/22/87)
I am not an authority, but will share my impression of what Turbo is doing, and what I do to make this work. It appears from my experience that Turbo is using the earlier DOS read function calls (possibly for compatibility with earlier versions of DOS), and therefore you will have problems with the Turbo routines for Reset and Open. I created a program a while ago to make a copy of one disc to another (including ALL files and directories, including Hidden, Read-only and System files and directories, excluding the DOS boot files) so that I could quickly and easily copy one 20 MByte hard disc to another Hard disc of a different size. I used the newer DOS function call 3D (and related 3x function calls), which allowed me to read files regardless of attribute. You can actually specify how you want the file opened (exclusively, shared, etc.), and whether the file must be a "normal" file, or can have special attributes. Of course, all of this means having to write your own procedures to access DOS (though this is really quite simple). I hope this point you in a direction to accomplish your needs.