Interprets the receiver as a system-independent path and fills a buffer with a C-string in a format and encoding suitable for use with file-system calls.
- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
Upon return, contains a C-string that represent the receiver as as a system-independent path, plus the
NULLtermination byte. The size of
buffermust be large enough to contain
The maximum number of bytes in the string to return in
buffer(including a terminating
NULLcharacter, which this method adds).
buffer is successfully filled with a file-system representation, otherwise
false (for example, if
max would be exceeded or if the receiver can’t be represented in the file system’s encoding).
This method operates by replacing the abstract path and extension separator characters (‘
/’ and ‘
.’ respectively) with their equivalents for the operating system. If the system-specific path or extension separator appears in the abstract representation, the characters it is converted to depend on the system (unless they’re identical to the abstract separators).
Note that this method only works with file paths (not, for example, string representations of URLs).
The following example illustrates the use of the
max argument. The first method invocation returns failure as the file representation of the string (
@"/mach_kernel") is 12 bytes long and the value passed as the
max argument (
12) does not allow for the addition of a
NULL termination byte.