读取大型二进制文件(2-3 GB)的每30个字节的最快方法是什么?我已经读过由于I/O缓冲区导致fseek存在性能问题,但我不想在每30个字节抓取之前将2-3 GB数据读入内存.
我正在尝试使用以下代码将NSNetService(名为"My_Mac")解析为后台应用程序中的IP:
NSNetService *service = [[NSNetService alloc] initWithDomain:@"local." type:@"_daap._tcp" name:@"My_Mac"];
[service setDelegate:self];
[service resolveWithTimeout:5];
Run Code Online (Sandbox Code Playgroud)
在同一个类中,我定义了这些委托方法:
- (void)netServiceDidResolveAddress:(NSNetService *)sender
- (void)netService:(NSNetService *)sender didNotResolve:(NSDictionary *)errorDict
Run Code Online (Sandbox Code Playgroud)
这是一个奇怪的部分:除非我在"[service resolveWithTimeout:5];"之后运行NSAlert,否则不会调用委托方法.有任何想法吗?
AppleScript太慢了,所以我尝试使用ScriptingBridge打开System Preferences.app并设置当前窗格,这也太慢了.有更快的方法吗?正确
uint8_t类型的sscanf占位符是什么?我试过%u,但OS X下的gcc不喜欢它.