0
我的代碼讀取在Xcode控制檯總是給人一個錯誤:試圖讀取Xcode的控制檯輸出
讀:壞的文件描述符
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"Some text...");
int fd;
char ch[1024];
fd = read(stderr,ch, sizeof(ch));
if(fd == -1) {
perror("read");
} else {
NSLog(@"Data Read : %s", ch);
}
}
有什麼不對呢?
你想做什麼?你不要讀stderr。 – 2011-05-29 18:54:07