[linux]strerror perror

int main(void)
{
int fd;
fd = open(“./test_file”,O_RDONLY);
if (-1==fd)
{
printf(“Error:%s\n”,strerror(errno));
//perror(“open error”);
return -1;
}
close(fd);
return 0;
}

Error:No such file or directory
open error:NO such file or directory

发表评论

邮箱地址不会被公开。 必填项已用*标注