| Log In | Not a Member? |
Contact ADC
|
|
QuickTime and File System PathnamesDispatch 4Operating systems typically use pathnames to indicate the location of files, directories and volumes. The MacOS, on the other hand, doesn't use pathnames to describe the location of files and directories. Instead it uses a structure called a FSSpec to describe a file or directory's current location. QuickTime, owing in part to its origins on the Macintosh, also uses FSSpecs to describe locations of files. Because those parts of the QuickTime API that expect files take FSSpecs as parameters, native pathnames must be converted to FSSpecs for use with those APIs. Likewise, developers may find it necessary to convert from a FSSpec to a pathname for use with an OS service. To that end, on platforms other than the Macintosh, QuickTime provides two API functions to convert from native pathname strings to FSSpecs and back. EXTERN_API(OSErr) NativePathNameToFSSpec( const char * pathname, FSSpecPtr theFile, long flags ); Given a C string pathname from the operating system, this function updates FSSpec theFile to describe the same file. Currently, there are no flags defined so pass 0 for now. In the future, this function may accept additional options and flags will then accept new values. If the file doesn't currently exist, the error fnfErr is returned but the FSSpec is still a valid FSSpec for creating the file. EXTERN_API(OSErr) FSSpecToNativePathName( FSSpecPtr theFile, char * pathname, UInt16 pathnameMaxBufferSize, long flags ) Sometimes developers need to convert a FSSpec returned by
QuickTime APIs to a native pathname to be passed onto the current
operating system. Three flags are defined for
As an example, consider the following Windows full path: D:\Media\My Movies\Really Cool Movies\Tasty Fish.mov If we have an FSSpec for this path, we can extract either the whole path or portions of the path using one of the above flags. For the above path and the each flag, the resulting strings are:
NOTE: Before these functions were introduced to the QuickTime API,
the recommended way to convert from native pathnames to FSSpecs was
to convert the pathname into a Pascal string using c2pstr and then
pass that string to
FSpMakeFSSpec
are encouraged to change that code to use the new calls.
See AlsoQuickTime for Windows Programming Guide - Utility functions Change History4/16/98 - clf - First published |
|
Topics Previous | Next |