我有一个使用fchmod的函数createFile:
int createFile(char *pFileName) {
int ret;
if ((ret = open(pFileName, O_RDWR | O_CREAT | O_TRUNC)) < 0)
errorAndQuit(2);
fchmod(ret, S_IRUSR | S_IWUSR);
return ret;
}
Run Code Online (Sandbox Code Playgroud)
在我的文件顶部,我有以下内容:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
Run Code Online (Sandbox Code Playgroud)
编译时:编译器吐出:
warning: implicit declaration of function ‘fchmod’
Run Code Online (Sandbox Code Playgroud)
我包含了所有正确的文件,但却得到了这个警告.该程序运行正常,即使有警告.