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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.