QBasic / QB 4.5 / VB for DOS 
Author Message
 QBasic / QB 4.5 / VB for DOS

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
Rudi van den Brink



Tue, 11 May 1999 03:00:00 GMT  
 QBasic / QB 4.5 / VB for DOS


Quote:

>Subject: QBasic / QB 4.5 / VB for DOS
>Date: 22 Nov 1996 07:40:56 GMT
>Summary: The Lock statement appears to lock the whole Random file
>Keywords: QBasic, Lock, Unlock
>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
>Rudi van den Brink

The default lock mode on OPEN file is  "exclusive".   In order for LOCKing to
work at record level you must:
 OPEN "Myfile.Dat" FOR RANDOM SHARED  AS #1


Tue, 11 May 1999 03:00:00 GMT  
 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



Tue, 11 May 1999 03:00:00 GMT  
 QBasic / QB 4.5 / VB for DOS

Quote:

> He's using WIN95.   He won't need to load SHARE.EXE. He does
> need to OPEN SHARED though.

Right you are.
See, I learn something new every day, or at least I try to.

Thanks for pointing that out.

--


Bangor, Pa. USA



Tue, 11 May 1999 03:00:00 GMT  
 QBasic / QB 4.5 / VB for DOS

Quote:


>Subject: Re: QBasic / QB 4.5 / VB for DOS
>Date: Fri, 22 Nov 1996 18:41:53 -0500

>> 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.

He's using WIN95.   He won't need to load SHARE.EXE. He does
need to OPEN SHARED though.


Wed, 12 May 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Incorporating non-QBasic graphics into QB 4.5 programs

2. How do you make LARGE matrices in qbasic or qb 4.5

3. QB 4.5 for DOS, Command Line Options for BC.EXE

4. Accessing database files from QBasic 4.5, Visual Basic for DOS

5. QB 4.0 Docs/QB 4.5 Wanted

6. want QB 4.5 QB 7.1 FOR FREE!!!

7. Where's QB.LIB in QB 4.5?

8. Qbasic 4.5 vs Qbasic 7.1PDS

9. QB 4.5/Basic 7.1/VB 3/4/5 Consultants Available

10. Looking on information for Qbasic and Qbasic 4.5!

11. QB 4.5/Basic 7.1/VB 3/4/5 Consultants Available

12. QB 4.5 to VB Conversion

 

 
Powered by phpBB® Forum Software