gpt4 book ai didi

c++ - firebreath npplugin 中的文件写入权限被拒绝

转载 作者:行者123 更新时间:2023-11-30 17:59:47 29 4
gpt4 key购买 nike

源代码已在 Fedora 15,16 和 Ubuntu 10,11,12 中测试,没有问题。

但是在Fedora 17中,文件写入功能不起作用。

1)

int fd;
if ( 0 < ( fd = open("/home/test/temp/opentest.html", O_CREAT | O_EXCL, 0777))) {
write(fd, "test", strlen("test"));
close(fd);
return "Success";
} else {
return "Error";
}

返回值:错误

2)

FILE *pFile;
pFile = fopen("/home/test/temp/opentest.html", "w+");
if (pFile == NULL) {
return "Pointer is NULL";
} else {
fputs("fopen test", pFile);
fclose(pFile);
return "Success";
}

返回值:“指针为NULL”

估计是目录权限出错,设置了777权限。但一切都没有改变。

相同的代码可以在普通 C 程序中运行。

为什么它在 firebreath npPlugin 中不起作用?

权限方面有什么区别吗?

最佳答案

很可能该目录不存在,或者您没有写入该目录的权限。

这个命令有效吗?
echo 123 >/home/test/temp/opentest.html

关于c++ - firebreath npplugin 中的文件写入权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11114369/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com