"Path/File Access Error"; OPEN FOR APPEND ACCESS WRITE (31151)



The information in this article applies to:

  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q31151

SUMMARY

A "path/file access error" message occurs when OPENing with FOR APPEND ACCESS WRITE.

The error occurs because the designated file needs to be READ in order to be APPENDed. If the file is OPENed with ACCESS WRITE, READing privileges have not been provided.

To eliminate the error message, omit the ACCESS clause or change ACCESS WRITE to ACCESS READ WRITE.

This information also applies to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2 and to Microsoft Basic PDS Version 7.00 for MS-DOS and MS OS/2.

The following code example demonstrates this behavior:
OPEN "test1.dat" FOR APPEND ACCESS WRITE as #1   ' Incorrect.
' OPEN "test1.dat" FOR APPEND ACCESS READ WRITE as #1   ' Correct.
FOR k = 1 TO 100

        WRITE #1, "hello", k

NEXT k
close #1
				

Modification Type:MajorLast Reviewed:11/18/2003
Keywords:KB31151