Microsoft KB Archive/38071

= &quot;Permission Denied&quot; If SHELLed Process Accesses Same OPEN File =

Article ID: 38071

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q38071



SUMMARY
&quot;Permission Denied&quot; normally occurs when you attempt to access a file that is locked by another process or attempt to write to a write-protected disk.

For example, if you OPEN a file, LOCK any record, then SHELL to another program that attempts to access the same file, a &quot;Permission Denied&quot; error properly occurs.

This information applies to Microsoft QuickBasic versions 4.00, 4.00b, and 4.50 for MS-DOS; to Microsoft Basic Compiler versions 6.00 and 6.00b for MS-DOS and MS OS/2; and to Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.



MORE INFORMATION
The following program, which SHELLs to a copy of itself, correctly gives a &quot;Permission Denied&quot; error when run from an .EXE file or from within the QB.EXE or QBX.EXE editor (if you have first created TEST.EXE): TEST.BAS OPEN &quot;TEST.DAT&quot; FOR RANDOM AS #1 LOCK #1, 3 SHELL &quot;TEST.EXE&quot; UNLOCK #1, 3 END The following program also demonstrates &quot;Permission Denied&quot; if you attempt to run TEST.EXE from within the SHELL session, before giving the EXIT command to end the child process (session): OPEN &quot;TEST.DAT&quot; FOR RANDOM AS #1 LOCK #1, 3 SHELL         ' Before saying EXIT, run TEST.EXE to show the UNLOCK #1, 3  ' &quot;Permission Denied&quot; message. END

Additional query words: QuickBas BasicCom

Keywords: KB38071

-

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

© Microsoft Corporation. All rights reserved.