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: 回覆: Re: Renaming a file



Hi Angelo,


Am 21.06.2007 um 12:50 schrieb Angelo Chen:

Hi Mike,

Your method works very well, Thanks. Actually the
original name is a FSRef, I tried to avoid that
because I'd like to do some process, like this:  if
original file name has an extension mpeg$, then I have
to rename it to mpeg, anyway to do this from a FSRef?

I'm not sure what you're asking for here? If you need to get the original file name then FSGetCatalogInfo() is your friend.



Mike

PS. Please don't take discussions off list. You are limiting the potential replies you might get by doing that.



Thanks,

--- Mike Fischer <email@hidden> 說:

To summarize:

Depending on how you actually get the path to the
file in the first
place you could do this:

UInt8 x[] = "/Users/justin/Movies/e1.mov";  // Just
for illustration.
FSRef ref;
OSStatus err = FSPathMakeRef(x,&ref,NULL);

if (noErr == err)
{
   // Just for illustration. Use a better method to
get the new name
in real code:
   UniChar newName[] = {0x0065, 0x0031, 0x002e,
0x006d, 0x006f,
0x0076, 0x0078};

   err =

FSRenameUnicode(&ref,(UniCharCount)(sizeof(newName)/sizeof

(UniChar)),newName,kTextEncodingUnknown,NULL); }


HTH Mike -- Mike Fischer Softwareentwicklung, EDV-Beratung Schulung, Vertrieb Web: <http://homepage.mac.com/mike_fischer/index.html> Note: I read this list in digest mode! Send me a private copy for faster responses.





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




-- Mike Fischer Softwareentwicklung, EDV-Beratung Schulung, Vertrieb Web: <http://homepage.mac.com/mike_fischer/index.html> Note: I read this list in digest mode! Send me a private copy for faster responses.

_______________________________________________
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


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.