PRB: Permission Denied When Using BLOAD to Load Open File

ID: Q112045


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
  • Microsoft QuickBASIC for MS-DOS, version 4.5
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, versions 7.0, 7.1


SYMPTOMS

Using BLOAD to load a file into memory when that file is already open with write access results in error 5, "Permission Denied."


CAUSE

When you try to use BLOAD to load an open file that was opened for SHARED or ACCESS READ WRITE, you are denied permission. This is by design.


RESOLUTION

If you need to use BLOAD to load a file that is already open, either close the file or make sure the file was opened for ACCESS READ.


STATUS

This behavior is by design.


MORE INFORMATION

How to Reproduce the Behavior

The following code segment results in the "Permission Denied" error:

OPEN "C:\TEST.SAV" FOR RANDOM SHARED AS #1
BLOAD "C:\TEST.SAV"                         'Error 5 occurs here

NOTE: C:\TEST.SAV must be a valid BSAVE file. 


WORKAROUND

The following code segment shows how to open the data file for readonly access so that the BLOAD statement does not generate an error:


OPEN "C:\TEST.SAV" FOR RANDOM ACCESS READ AS #1
BLOAD "C:\TEST.SAV"                          'No error 

Additional query words: VBmsdos QuickBas BasicCom 1.00 4.50 7.00 7.10 b_quickbas b_basiccom

Keywords :
Version : MS-DOS:1.0,4.5; :7.0,7.1
Platform : MS-DOS
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.