![]() |
Quote:
Quote:
I think that's a disingenuous argument. At what point do you distinguish the "Finder" from the "OS" ...? Similarly, one might suggest that UNIX could exist without /bin, but then it wouldn't be the same OS. |
Quote:
|
Hi Triple-A
I had tried ls -ls - file/..namedfork/rsrc . 1) first i changed icon of a abc.cpp file. According to u, this file have resource fork. 2) And i run command ls -l abc.cpp/..namedfork/rsrc and i got the result rw-r-r-- 1 punitsin punitsin 46901 Jun 5 14:27 abc.cpp/..namedfork/rsrc is it desired answer?? if yes then wht's 46901, plz tell me. Act therare one more file xyz.rtf , i didnt changed icon for this file and fire same command for it. and i got the same result but i little bit diffrence. rw-r-r-- 1 punitsin punitsin 0 Jun 5 4:27 xyz.rtf/..namedfork/rsrc plzz tell me how can i know that abc.cpp have resource fork. thanx in advance anurags thanx anurag |
Excuse me for butting in as an absolute non-expert, but I seem to have missed something here. Resource forks are only ever used now to hold things that could just as well have been in a resource folder of a bundle. Shouldn't the OP just be creating a bundle for his app?
|
Quote:
By the way, please avoid using abbreviations like "wht" & "plz". This is not a chat room and there is no reason to save keystrokes. Precision of communication is much more important. Quote:
|
Quote:
|
Hi Hayne
Quote:
You are right that i am writing an utility which will deal with resource fork of existing file. anurags |
Format Of Resource Fork
Hi All
finally i got the resource fork from a file, i have checked it, it's seems good. Actually i have read documentation about resource fork that i got from apple's site. http://developer.apple.com/documenta...ml#HEADING99-0 But there are some problem in my resource fork. The offset in resource map table is false for resoutce type list and reference list. Act i have one resource mean...there is one type and one resource id. So offset for resource typelist would be 1e(30) but the entry in the resource fork is 1c(28). Smilary for offset of reference list, entry in the typelist is 0a but it should be 8. I am not getting what happend act. if any know abt it, pease let me know...Actually what's happend with my resource fork. Anurags |
Relatively few Mac developers nowadays deal with resource forks.
In particular, I have no experience programming the contents of a resource fork. It is therefore unlikely you will get the help you need on these forums. You'd do better on a more specialized mailing list - e.g. the Carbon mailing list (see lists.apple.com) |
Hi All
By adding custom icon we can add resource fork in any file,but i have a requirement that any file which have atleast two resource fork. So please tell me , one another way through which i can add one more resource in resource fork. I am also trying with carbon API, but each n every time AddResource API is failed. #include <stdio.h> #include <Files.h> // Open resource fork and add a resource in the fork int main (int argc, const char * argv[]) { // insert code here... FILE *fPtr = NULL ; size_t byteWritten = 0 ; UInt8 *filePath = (UInt8 *) "/Users/punitsindhwani/Documents/rsrc_fork/Testing/mac_rsrc_fork/rsrc.rtf" ; SInt16 forkRefNum = 0 ; SInt64 forkSize = 0 ; ByteCount actualCount = 0 ; //SInt16 fileRefNum = 0 ; void *buffer = NULL ; OSErr err ; FSRef fsref ; Boolean isDirectory = false ; HFSUniStr255 resourceForkName; UniCharCount forkNameLength; UniChar *forkName; ResType resourceType; short resourceID; char *rData = "Anurag" ; // make FSRef from path err = FSPathMakeRef(filePath, &fsref, &isDirectory) ; if((err != noErr) && (isDirectory)) { printf("\nFSPathMakeRef() Functin failed.\n"); return 1; } // Get Resource Fork name err = FSGetResourceForkName(&resourceForkName); if(err != noErr) { printf("\nFSGetResourceForkName() Functin failed.\n"); return 1; } forkNameLength = resourceForkName.length ; forkName = resourceForkName.unicode ; // Open Resource Fork /* err = FSOpenFork(&fsref,forkNameLength,forkName,fsRdWrPerm, &forkRefNum); if(err != noErr) { printf("\nFSOpenFork() Function failed.\n"); return 1; } */ // change resource fork err = FSOpenResourceFile(&fsref,forkNameLength,forkName,fsRdWrPerm, &forkRefNum); if(err != noErr) { printf("\nFSOpenResFile() Functin failed.\n Error No -> %d\n",err); return 1; } UseResFile(forkRefNum); err = ResError(); if(err != noErr) { printf("\nUseResFile() Functin failed.\nError No -> %d\n",err); return 1; } // Add resource resourceType = 'STR' ; resourceID = 128 ; AddResource(rData,resourceType,resourceID,""); err = ResError(); if(err != noErr) { printf("\nAddResource() Functin failed.\nError No -> %d\n",err); return 1; } UpdateResFile(forkRefNum); err = ResError(); if(err != noErr) { printf("\nUpdateResFile() Functin failed.\n Error No -> %d\n",err); return 1; } // Get size of the open fork err = FSGetForkSize(forkRefNum, &forkSize); if(err != noErr) { printf("\nFSGetForkSize() Functin failed.\n"); return 1; } // Assign memory to buffer buffer = malloc(forkSize); memset(buffer, '0', forkSize); // Read Resource fork err = FSReadFork(forkRefNum, fsFromStart, 0, forkSize, buffer, &actualCount); if(err != noErr) { printf("\nFSReadFork() Functin failed.\n"); return 1; } // Open a file and Write buffer in the file. fPtr = fopen("rsrc_fork.frk","wb+"); if(fPtr == NULL) { printf("\nfopen() Functin failed.\n"); return 1; } byteWritten = fwrite(buffer, 1, forkSize, fPtr); if(byteWritten != forkSize) { printf("\nfwrite() Functin failed.\n"); return 1; } // close file err = fclose(fPtr); if(err != noErr) { printf("\nfclose Functin failed.\n"); return 1; } // To Close Resource fork err = FSCloseFork(forkRefNum); if(err != noErr) { printf("\nFSCloseFork Functin failed.\n"); return 1; } return 0; } Each and every time AddResource() failed and err no is -111. please let me know wht's is wrong here. Thanks In Advance Anurag |
Quote:
resourceType = 'STR ' ; |
| All times are GMT -5. The time now is 06:19 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.