Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Renaming a file



On 21/06/07, Angelo Chen <email@hidden> wrote:
Hi,

I have following code to rename a file, but I always
get error -43(file not found), any help? Thanks,

Firstly, you're using FSMakeFSSpec wrong. It requires a full or partial HFS path, not POSIX path.

Secondly, FSSpecs are old and busted. Use FSRefs instead. Specifially,
use FSPathMakeRef and FSRenameUnicode.

-- Finlay


//path2fss makes an FSSpec from a path with or without a filename int path2fss(FSSpec *fss, char *path) { char buf[256]; char *p = &buf[1]; strcpy(p, path); //convert to Str255 buf[0] = strlen(p); return(FSMakeFSSpec(0, 0, (unsigned char *)buf, fss)); //== noErr }




char *x = "/Users/justin/Movies/e1.mov"; FSSpec fspc; path2fss(&fspc, CFStringGetCStringPtr(pathName, nil)); path2fss(&fspc, x); err=FSpRename(&fspc,"/Users/justin/Movies/e1.movx");



      現在你可輕易阻擋垃圾郵件,立即使用Yahoo! Mail你就會相信!


_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Renaming a file (From: Angelo Chen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.