Re: Saving an AudioFile without an extension (Modified by Marc Poirier)
Re: Saving an AudioFile without an extension (Modified by Marc Poirier)
- Subject: Re: Saving an AudioFile without an extension (Modified by Marc Poirier)
- From: Marc Poirier <email@hidden>
- Date: Mon, 12 Jul 2004 09:01:59 -0400
- Resent-date: Mon, 12 Jul 2004 09:03:01 -0400
- Resent-from: Marc Poirier <email@hidden>
- Resent-message-id: <A8EFF426-D403-11D8-B533-000393A708B4@smartelectronix .com>
- Resent-to: email@hidden
First of all, don't make FSSpecs. They are deprecated, and for good
reasons (no Unicode file names, no long file names only 31 characters
max, Pascal strings, etc.).
Secondly, you're giving a file path as the file name parameter.
Thirdly, you're giving a C string when you need to give a Pascal string.
But really, just don't use FSSpecs. You can create an FSRef with your
C string file path like this:
FSRef destFileRef;
FSPathMakeRef(destFilePath, &destFileRef, NULL);
Or a CFURL like this:
CFURLRef destFileUrl = CFURLCreateWithBytes(kCFAllocatorDefault, (const
UInt8*)destFilePath, strlen(destFilePath), kCFStringEncodingASCII,
NULL);
Either is a good choice for Mac OS X programming. In the case of the
FSRef, if the file does not exist yet, you need to create it first with
the FS APIs since an FSRef cannot be created for a file or directory
that does not yet exist. CFURLs can, though.
Marc
On Jul 12, 2004, at 6:05 AM, Asher Vander Heiden wrote:
Hey,
I'm having trouble with using the 'FSMakeFSSpec' to make a 'FSSpec' !
As far as I can tell to use 'FSMakeFSSpec' I will do something like
this:
FSSpec fspec;
char* destFilePath = "/Users/lachlanbarratt/Desktop/NewFile";
error = FSMakeFSSpec(0,0,destFilePath,&fspec);
Now why does this destination file path (destFilePath) not work in
this function ???!!!????
It says that the error is that "destFilePath" should be an "unsigned
char*" for some strange reason!
Even when I create a path name that is an "unsigned char*" It still
Doesn't Work!!!!
What am I doing wrong here?
Please help ...... I am pulling my hair out .....
I cannot explain why Apple have decided to use so many different types
of strings ??? I've probably wasted about 2 weeks work just trying to
satisfy all of Apples string requirements. This is the first and maybe
the last time I work with Apple.
Thankyou for any help,
Asher Vander Heiden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.