Traversing /dev
Hi
I am new to the Linux platform. How can I write a program that traverses /dev and prints the major and minor numbers for the devices |
In C, you would use opendir and readdir to traverse the directories, and stat to examine the file details. The stat call will give (amongst other things) the device id st_rdev, and you can extract the device numbers from this using the major and minor macros which are found in 'sys/sysmacros.h' (which is included by 'sys/types.h').
|
A respectable reply. Thanks neonsignal.
|
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place.
Because there are posts in both threads, I'll get this one merged into the other |
Thanks Alot!!
That was great help! |
Closed in favour of the more sensibly placed dupe.
http://www.linuxquestions.org/questi...ng-dev-765489/ |
All times are GMT -5. The time now is 02:43 PM. |