
QBasic / QB 4.5 / VB for DOS
Quote:
> Using QBasic, but also QuickBasic and VB for DOS, I tried to Lock a record in
> a file: LOCK #1, 2 (where "2" indicates that I lock the second record).
> I then want to read that record via another DOS instance under Win95. The OPEN
> statement fails with error 70 (Permission Denied).
> According to the help screen, sequential files are entirely locked with LOCK,
> but random files can be locked record for record. However, this seems not to
> be the case. Does anyone recognise this problem? Is so, please comment here.
> Thanks in advance
Look into SHARE.EXE.
You must first run Share.exe at the dos prompt before you can use LOCK/UNLOCK.
Without it you get just what you said "Error 70" since sharing is not enabled.
Typing share /? gets you the following bit of help info on share.
Installs file-sharing and locking capabilities on your hard disk.
SHARE [/F:space] [/L:locks]
/F:space Allocates file space (in bytes) for file-sharing information.
/L:locks Sets the number of files that can be locked at one time.
Here's a piece of what PDS 7.1 help has to say about it.
LOCK and UNLOCK execute only at run time if you are using OS/2 or
versions of DOS that support networking (version 3.1 or later). In
DOS, you must run the SHARE.EXE program to enable locking operations.
Earlier versions of DOS return an error message that reads, "Advanced
feature unavailable," if LOCK and UNLOCK are executed.
--
Bangor, Pa. USA