核心基础相当于NSLog

Nic*_*ore 11 cocoa core-foundation

与NSLog功能最接近的Core Foundation功能是什么?

Jen*_*ton 9

CFShow()是类似的,但没有前缀的东西.或者,正如wbyoung所说,使用NSLog().如果您不想使用Objective-C,则以下内容完全有效(尽管它需要链接到Foundation.framework):

#if __cplusplus
extern "C" {
#endif
void NSLog(CFStringRef format, ...);
void NSLogv(CFStringRef format, va_list args);
#if __cplusplus
}
#endif

int main (int argc, const char * argv[])
{
    NSLog(CFSTR("Hello, World! %u"), 42);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)