开发者

NSStream, NSError, error code

I'm developing small FTP upload app. for mac (10.6 if it matters)

Have problem with NSStream, actually I cannot understand how to find our error by its code.

NSError code=14 domain=NSPOSIXErrorDomain

Where to check what does开发者_如何学编程 14 means?

Thank you.

Just in case here is my code (maybe you can also tell me why I have an error)

NSString *              filePath;
NSInputStream *         fStream;
NSStreamStatus *        status;
NSError *               error;  


filePath = @"/Users/Vic/Desktop/ftptest.txt";   
fStream = [NSInputStream inputStreamWithFileAtPath:filePath];
[fStream open];



uint8_t *         buffer;

NSInteger   bytesRead;

bytesRead = [fStream read:buffer maxLength:32768];

error = [fStream streamError];

NSLog(@"error code=%d domain=%@",error.code,error.domain);


Each domain has the error codes in a different place, but there's a summary in the Error Handling Guide for Cocoa. There's even a summary of some of the POSIX ones there. 14 is EFAULT.

Lots of times if you know the underlying system call you can view its man page to get more information about the error code. For instance in this case, you can invoke man 2 read from the terminal and it states:

 [EFAULT]           Buf points outside the allocated address space.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜