gpt4 book ai didi

objective-c - 如何从包含路径的 NSString 创建 FSRef?

转载 作者:搜寻专家 更新时间:2023-10-30 19:57:28 25 4
gpt4 key购买 nike

我在 NSString 中有一个文件系统路径,但我需要一个 FSRef 用于我将要进行的系统调用。创建 FSRef 的最佳方法是什么?

最佳答案

试试 FSPathMakeRef:

NSString *path = @"Some... path... here";
FSRef f;
OSStatus os_status = FSPathMakeRef((const UInt8 *)[path fileSystemRepresentation], &f, NULL);

if (os_status == noErr) {
NSLog(@"Success");
}

关于objective-c - 如何从包含路径的 NSString 创建 FSRef?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/977685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com