Microsoft KB Archive/42463

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base

How Macintosh QuickBASIC Uses Resource and Data Forks of Files

Article ID: 42463

Article Last Modified on 1/8/2003


  • Microsoft QuickBasic Compiler for Macintosh 1.0

This article was previously published under Q42463


Any file stored on a Macintosh disk has two parts or forks: a resource fork and a data fork.

The resource fork is also known as a "resource file."

Resources are specially formatted pieces of data stored in the resource fork. An application file, for example, may keep resources such as fonts, icons, menus, and application code in its resource fork.

The application can keep anything it wishes in the data fork (often nothing). The data fork is often used for the contents of data files.

Chapters 4 and 8 of the following book give more technical details about Macintosh files:

"Technical Introduction to the Macintosh Family," by Apple Computer (published by Addison-Wesley, 1987)


The QuickBASIC (b) or (d) application itself has an empty data fork, and just uses its resource fork.

The code for your program is located in the data fork in the disk files for compiled and interpreted programs.

Files created with the OPEN statement in a QuickBASIC program store data in the data fork. They have an empty resource fork, unless you perform OpenResFile on that file and write some resources.

You can place resources into the resource fork of any file by using ResEdit, the "Statement Mover" program, or your own program that invokes Toolbox routines (such as OpenResFile, AddRes, SaveArray, SaveCursor, SaveIcon, SavePicture, and SaveString).

Use SYSTEM(7) (instead of OpenResFile) to get the file reference number of resources stored in a running source file or compiled application. OpenResFile should only be used for accessing resource files that are external to the program.

Additional query words: MQuickB

Keywords: KB42463