码迷,mamicode.com
首页 > 移动开发 > 详细

04clock_01misc_app_write

时间:2017-02-19 17:59:49      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:argc   ror   dwr   printf   app   stdio.h   error   span   bsp   

 1 #include <stdio.h>
 2 #include <sys/stat.h>
 3 #include <fcntl.h>
 4 #include <unistd.h>
 5 
 6 #define DEV_NAME "/dev/my_led"
 7 
 8 int main(int argc, char const *argv[])
 9 {
10     
11     int  fd = open(DEV_NAME, O_RDWR);
12     if(fd < 0) {
13         perror("open");
14         return -1;
15     }
16 
17     char buf[10] = "1234567890";
18 
19     //int ret = read(fd, buf, 10);
20     //printf("buf = %s\n", buf);
21 
22     write(fd, buf, 10); 
23 
24     close(fd);
25     return 0;
26 }

 

04clock_01misc_app_write

标签:argc   ror   dwr   printf   app   stdio.h   error   span   bsp   

原文地址:http://www.cnblogs.com/baoshulin/p/6416271.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!