ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

PowerPC & Writing Info to the Data Fork


Q: I'm developing a PowerPC version of my application. In the current version of my app, I write info into the data fork. What is the recommended way to do this for the Power PC?

In the documentation it talks about offsetting the data using the cfrg resource. Would this help? If so, can this be done using Metrowerks CodeWarrior?

A: Yes. Writing information to the data fork of a PowerPC-native application is supported. You can actually write the code fragment and update the 'cfrg' using MergeFragment. MergeFragment takes two files and catenates them. It also updates the offset and length fields for the code fragment's 'cfrg' resource, which doesn't necessarily have to start at the beginning of the fork. In fact, it's easier to read the serial information if you write the code fragment after the serial information.

A caveat: You need to make sure the offset written to the 'cfrg' is an even value, and optimally, a multiple of four. MergeFragment should take care of this, but we recommend checking it in your final build to make sure your 'cfrg' and data fork are correct. If the offset is not an even value, VM's file-mapping won't work, and you won't notice a problem unless running your application on a system with VM enabled.

You can use MergeFragment with Metrowerks' Toolserver interface. Check out the Metrowerks documentation for more details.

[May 01 1995]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.