Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1286318
  • 博文数量: 548
  • 博客积分: 7597
  • 博客等级: 少将
  • 技术积分: 4224
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-15 13:21
个人简介

嵌入式软件工程师&&太极拳

文章分类

全部博文(548)

文章存档

2014年(10)

2013年(76)

2012年(175)

2011年(287)

9.c

分类: LINUX

2011-03-05 21:23:54

  1. #include <stdio.h>

  2. #include <sys/types.h>
  3. #include <sys/stat.h>
  4. #include <fcntl.h>

  5. int main(void)
  6. {
  7.     int fd, ret;

  8.     fd = open("./test", O_RDONLY);
  9.     if (fd == -1)
  10.     {
  11.         perror("open");
  12.         return -1;
  13.     }

  14.     ret = fchmod(fd, S_IRUSR | S_IRGRP | S_IROTH);
  15.     if (ret == -1)
  16.     {
  17.         perror("fchmod");
  18.         return -1;
  19.     }

  20.     close(fd);

  21.     return 0;
  22. }
阅读(444) | 评论(0) | 转发(0) |
0

上一篇:8.c

下一篇:10.c

给主人留下些什么吧!~~