ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Then I added printf("fbfd=%d\n",fbfd);
it returned fbfd=-1;
so open() fails
You always, always need to check the return value of any function you call - now that you can run the program as root you might get away with it, but put a check in for the return value of the open() command, or later on you might get led up another garden path.
On another note, you can still open the file if you add yourself to the group 'video' by placing your name on the 'video' line of /etc/group. For example, to add myself to 'video' on my system, the following line:
should be changed to:
you can then make sure you're in that group by running the command 'groups', which will show you all the groups you're in.
This is a much, much safer option than running your program as root, lest you do any permanent damage to your system.
Thanks a lot.
Now I can draw a point, a line and a circle both on the arm board in my lab and on my own computer.
That afternoon I added myself to video group but still failed, so I turned to use sudo .
Today I ran the program without root and succeeded.
And by running the command 'groups', I see 'video'.
I add a new user ,lwhat, and add him to video group, and run 'groups', I cannot see video.
Then I log off and login ,and lwhat is in the group video and of course is able to run the frame buffer program.
I guess I should exit and login to allow the changes to happen.