Microsoft KB Archive/112045

= PRB: Permission Denied When Using BLOAD to Load Open File =

Article ID: 112045

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Visual Basic for MS-DOS
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q112045



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.



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: kbprb KB112045

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.