LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-17-2006, 01:01 AM   #1
Nishant Desai
Member
 
Registered: Jul 2006
Posts: 100
Blog Entries: 1

Rep: Reputation: 15
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
 
Old 11-17-2006, 06:49 PM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 66
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
 
Old 11-18-2006, 04:09 PM   #3
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 638

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Take a look at

http://www.faqs.org/docs/Linux-mini/...ogramming.html

especially sections 2 and 9 (Example).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/dev/sg0 access...how ? FISICO Linux - Hardware 1 11-20-2005 08:50 AM
I cannot access EITHER CD drive! And there's no /dev/hdc or /dev/hdd or /dev/cdrom! Dmalic Linux - Hardware 13 11-18-2005 07:11 PM
Samba access by Windows users locking out directory access with Konqueror harry_fine Suse/Novell 1 12-18-2004 05:33 AM
how to access /dev/hdx ngan_yine Slackware 10 10-22-2004 04:23 PM
I have overwritten /dev/fd0! How do I recreate /dev/fd0 to access my floppy? drscott1 Linux - Newbie 2 02-19-2004 12:37 PM


All times are GMT -5. The time now is 11:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration