Writing to the resource fork

Mark Schonewille m.schonewille at economy-x-talk.com
Thu May 27 17:25:57 CDT 2010


For a new project, it is essential that I can read from and write to  
the resource fork of a file. I am not looking for a way to copy  
resource forks.

I am trying to use the setResource function, but it doesn't work. I  
tried it with Rev 4.0 on Mac OS X 10.5 and Rev 2.6.1 on Mac OS 9.2.2.  
With both systems, I get the same result: the resource is created  
(including ID, name and flags, but the data are not written to it.

On Mac OS X, contrary to what the documentation claims, the file isn't  
created automatically, if the file doesn't exist yet. Therefore, I  
create the file before writing the resource fork.

Does anyone have a clue about what might be wrong with the following  
two lines?

  put empty into url "binfile:~/desktop/resource test.dat"
  get setresource("/Users/Mark/desktop/resource test.dat","MARK", 
999,"Test","U","Hello World")

Althought the serResource function doesn't work correctly for me, the  
getResource and getResources functions work fine on both systems.

I tried to find a solution in the archives, but it looks like this  
function is rarely used. I need it though.

Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer

Economy-x-Talk is always looking for new projects. Contact me for a  
quote http://economy-x-talk.com/contact.html
Download Clipboard Link http://clipboardlink.economy-x-talk.com and  
share the clipboard of your computer over the local network.

More information about the use-livecode mailing list