系统调用open()权限 [英] System call open() permissions

查看:586
本文介绍了系统调用open()权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用系统调用打开一个文件的open()

I open a file using the system call open().

if ((fd2 = open(logFile, O_RDWR |O_APPEND | O_CREAT ), 0666) == -1)
    DieWithError("open() failed");

我的文件,该文件是FTP_track.log是没有任何问题的产生。现在的问题是,虽然我有模式 0666 ,其读取和写入所有,我无法打开UNIX文件。我必须要改变从文件的属性权限,读取和写入。

My file which is FTP_track.log is created without any problem. The problem is although i have mode 0666, which is read and write for all, I can not open the file in unix. I have to change permissions from the file's properties to read and write.

任何想法?谢谢。

推荐答案

与行的问题是,括号不匹配。你的前pression被解析为 FD2 =开(),0666 。在C除权pression 表达式1,表达式2 值为表达式2 所以你的如果语句基本上说 FD2 = 0666

The problem with your line is that the parenthesis don't match up. Your expression is parsed as fd2 = open(), 0666. In C the expression expr1, expr2 has the value expr2 so your if statement basically says fd2 = 0666.

这篇关于系统调用open()权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆