如何在Obj-C中打开和读取资源分支 [英] How to open and read resource forks in Obj-C

查看:114
本文介绍了如何在Obj-C中打开和读取资源分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧的(OS9)文件,其中包含带有"CODE"资源的资源分叉,我想从Obj-C读取该文件. 我使用类似的东西:

I have an old (OS9) file containing a resource fork with "CODE" resources and i would like to read that from Obj-C. I use something like:

NSFileHandle *codeFile=[NSFileHandle fileHandleForReadingAtPath:myPath];

但是只能看到数据分支! 有什么简单的解决方案吗?

but see only the data fork! Is there any simple solution for that?

我还尝试用

"CpMac -r myFile newFile" 

但是只取回旧文件吗?

推荐答案

打开路径

yourFile/..namedfork/rsrc

允许您访问"yourFile"的资源分支.或者,您可以使用getxattr(), 因为资源派生存储为名为"com.apple.ResourceFork"的扩展属性.

gives you access to the resource fork of "yourFile". Alternatively, you can use getxattr(), because the resource fork is stored as an extended attribute named "com.apple.ResourceFork".

这篇关于如何在Obj-C中打开和读取资源分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆