macosfile-forks

How to read and write resource forks in OS X 64 bit applications


Writing an archival utility, I need to be able to read and write resource forks on Mac OS X file systems.

There used to exist FSOpenFork and related functions, but current documentation both online and included with Xcode (v7.1) does not even mention these functions any more.

Furthermore, functions such as GetEOF are not even available any more to 64 bit apps.

Which APIs are currently available for reading and writing resource forks? If you can, please provide the declarations for functions to open, read, write, close and inquire/set the EOF and current r/w offset.

Note: While I've added my own answer listing the replacement FS... functions, it would be nice if others could add more ways, such as using CFURL APIs or the named fork method (which uses a special file name, but I keep forgetting how that works).


Solution

  • The header file "Files.h" lists the available FS... functions.

    Here are a few replacements: