Microsoft KB Archive/35659

= QuickBASIC &quot;Device I/O Error&quot; Using CloseResFile on Source =

Article ID: 35659

Article Last Modified on 11/21/2006



This article was previously published under Q35659



SUMMARY
There is a correction for the &quot;Note&quot; in Section E.6.2, &quot;Resource Files,&quot; on Page 435 of the manual &quot;Microsoft QuickBASIC for Apple Macintosh: BASIC Language Reference.&quot; The &quot;Note&quot; should be changed to read as follows:

&quot;It is dangerous to close the resource fork of a currently running program.&quot;

This means that you should NEVER perform CloseResFile on the file reference number of a currently running program; otherwise, you can get &quot;Device I/O Error&quot; in the QuickBASIC environment and/or eventually lose your interpreted source file. If you need to write resource changes to the resource fork of a currently running (or loaded) program, perform UpdateResFile instead of CloseResFile.



MORE INFORMATION
Note that you can open external resource files with the OpenResFile statement, and close them with the CloseResFile statement. However, you should never need to perform OpenResFile on the currently running program, since it is already open, and the SYSTEM(7) function returns its file reference number.

The SYSTEM(7) function returns the file reference number of the resource fork of the program source file when the program is interpreted. SYSTEM(7) returns the file reference number of the application resource fork in a compiled application. A common programming practice is to store user-defined resources in their own resource fork instead of in a separate resource file.

You are allowed to perform CloseResFile on any resource file other than a currently running program. However, UpdateResFile must be used instead of CloseResFile to write resources to currently running (or loaded) program files.

You should NEVER perform a CloseResFile statement using the number returned by SYSTEM(7). In interpreted programs, you can cause a &quot;Device I/O Error&quot; at save time if you previously did a CloseResFile on the resource fork of the source file or of QuickBASIC itself. This can put garbage in the &quot;QuickBasic Settings&quot; file in your System Folder. To clean up the QuickBASIC settings, drag the &quot;QuickBasic Settings&quot; file into the trash on the desktop.

It is also possible to hang QuickBASIC with a program that closes QuickBASIC's or its own resource fork. If in doubt, use UpdateResFile instead of CloseResFile to write resource changes to disk.

Additional query words: MQuickB

Keywords: KB35659

-

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

© Microsoft Corporation. All rights reserved.