为什么write()文件后,ls-l 时为0呢?
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include"apue.h"
#include"unix_err.h"
int main(void)
{
int wfd;
char buf[]="abcd";
if(wfd = creat("foo", FILE_MODE) < 0)
{
perror("Create error for foo.\n");
}
if(write(wfd, buf, 4) != 4)
{
perror("Write error for foo. \n");
}
exit(0);
}
创建并写文件后,
ls -l foo
后 得到
-rw-r--r-- 1 abc group 0 Sep 12 11:27 foo
为什么 group 后为0呢?