Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 1 - Resource Manager / Resource Manager Reference
Resource Manager Routines / Getting Resource Sizes


You can use the GetResourceSizeOnDisk function to get the exact size of a resource. The GetResourceSizeOnDisk function is also available as the SizeResource function.

FUNCTION GetResourceSizeOnDisk (theResource: Handle): LongInt;
A handle to a resource.
Given a handle to a resource, the GetResourceSizeOnDisk function checks the resource on disk (not in memory) and returns its exact size, in bytes. If the handle isn't a handle to a valid resource, GetResourceSizeOnDisk returns -1, and ResError returns the result code resNotFound.

You can call GetResourceSizeOnDisk before reading a resource into memory to make sure there's enough memory available to do so successfully.

noErr0No error
resNotFound-192Resource not found
To check for errors, call the ResError function as described on page 1-47.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996