LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 09-06-2006, 09:39 AM   #1
abhijit_awalekar
LQ Newbie
 
Registered: Jan 2006
Posts: 5

Rep: Reputation: 0
Smile STAT on directories of PROC ???


Hello friends,
I am reading PROC directory through readdir().
I am successful in reading the directories in PROC
but i am not able to differentiate among them as
directory or file.
FUNCTION stat() runs good for . and ..
but for other it returns -1 since these are not
regular files.

Can anyone tell me how to differential them into
files or directories ?
 
Old 09-06-2006, 03:34 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Try to use d_type field of struct dirent (from readdir). Does it work for you?
 
  


Reply



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
hidden directories under proc... what are they for? : (/proc/.23142) syssyphus Linux - General 1 04-10-2006 03:23 PM
/proc/stat values don't add up ! mike0w Linux - General 0 10-25-2005 05:01 AM
New cpu values in /proc/stat? eldonz Linux - General 1 10-19-2005 12:16 PM
/proc/stat cpu info GDarkBladE Linux - Software 2 10-11-2005 03:16 PM
/proc/stat cpu ahz Programming 1 04-24-2005 07:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration