Please select To the mobile version | Continue to access the desktop computer version

OrangePi

 Login            
 Register            
Search
Hot search: orangepi
View: 1788|Reply: 2

application program code for driver development of orange pi win

[Copy link]

4

Threads

5

Posts

42

Credits

Novice

Rank: 1

Credits
42
Post time 2017-12-25 14:48:31 | Show all posts |Read mode
This is the application program code for driver development of orange pi win ...can anyone explain the logic of the program
#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<string.h>
int main(int argc, char *argv[])
{
int cnt, fd;
char buf[32]= {0};
if(argc !=2)
{
   Printf(“Usage : %s</dev/xxx>\r\n”, argv[0]);
Return -1;
}
fd = open (argv[1], 0_RDWR);
if(fd <  0)
{
printf(“APP Error  pen device is Failed!\r\n”);
return -1;
}
read(fd, buf, sizeof(buf));
printf(“buf = %s\r\n”, buf);
close(fd);
return 0;
}

3

Threads

79

Posts

1000

Credits

Gold member

Rank: 6Rank: 6

Credits
1000
Post time 2017-12-26 04:53:53 | Show all posts
This code just check if an input argument is provided and try to open, read and show the file content.

4

Threads

5

Posts

42

Credits

Novice

Rank: 1

Credits
42
 Author| Post time 2017-12-26 20:53:26 | Show all posts
thank u......
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Archiver|Mobile edition|Darkroom|OrangePi En ( 粤ICP备14086627号-2

2019-5-27 18:27 GMT+8 , Processed in 0.027057 second(s), 22 queries .

Powered by Discuz! X3.2

© 2014-2015 orangepibbs en.

Quick Reply To Top Return to the list