How to access the nodes under the /dev directory to access the device?
Dear All,
I want to access the parallel port in my program and for that i want to access the node from the /dev directory, which relates the parallel port. I know that to create the node, there is a command : "mknod nodename c majorno. minorno", but dont know how to access that node in my application, pls show me the way to do so. Thanks in Advance, Nishant |
Pretend like it is a file and use it accordingly. Unix/Linux is a "everything is a file" OS. The same routines (open, close, read, write, lseek, ect.) are typically available for every device. Some drivers also support ioctl messages which can be issued with the ioctl system call.
See also: man 2 open man 2 close man 2 read man 2 write man 2 lseek man 2 ioctl |
Take a look at
http://www.faqs.org/docs/Linux-mini/...ogramming.html especially sections 2 and 9 (Example). |
All times are GMT -5. The time now is 03:53 PM. |