我曾经NSFileHandle把writedata写成文件.
NSFilehandle *handle = [NSFileHandle fileHandleForWritingAtPath:@"path/of/file"];
@try {
[handle writedata:data];
} @catch (NSException *e) {
// when exception occur, never got here
NSLog(@"%@", e);
}
Run Code Online (Sandbox Code Playgroud)
当我的设备磁盘空间已满时,调用writedata将失败.但我无法抓住异常.
我的程序日志信息:
2014-05-23 16:17:24.435 mytest[12919:3203] An uncaught exception was raised
2014-05-23 16:17:24.435 mytest[12919:3203] *** -[NSConcreteFileHandle writeData:]:
No space left on device
2014-05-23 16:17:24.436 mytest[12919:3203] (
0 CoreFoundation 0x00007fff8fae725c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8cbb3e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8fae710c +[NSException raise:format:] + 204
3 Foundation 0x00007fff93640f31 __34-[NSConcreteFileHandle writeData:]_block_invoke + 84 …Run Code Online (Sandbox Code Playgroud) 我最近使用sqlite3和c语言.谁能告诉我一些方便的ORM for c?是否有必要为我自己的项目开发ORM机制?
我知道AC_SUBST(VAR)将VAR传递给Makefile.am。
有什么语法可以在configure.ac中将我的#define生成到config.h中吗?
ProtobufCAllocator *kvs_pb_allocator()
{
static ProtobufCAllocator allocator;
//do something here
return &allocator; //print the address, it is 0x2aaaaafc12c0
}
Run Code Online (Sandbox Code Playgroud)
在另一个程序中调用此函数(来自不同的文件):
ProtobufCAllocator *alloctor = kvs_pb_allocator();
//print the address, it is 0xffffffffaafc12c0
Run Code Online (Sandbox Code Playgroud)
为什么会出现这个问题?我写的另一个守护程序工作正常.就在这种情况下,它打印错误的值.