04clock_01misc_app

 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] = {0};
18
19     int ret = read(fd, buf, 10);
20     printf("buf = %s\n", buf);
21
22     close(fd);
23     return 0;
24 }
时间: 2024-10-11 00:11:58

04clock_01misc_app的相关文章