Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Blog -  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Preferences
Contribute
Link to Us
Search
Linux Jobs

Linux Today
Enterprise Linux Today
Apache Today
JustLinux.com
Linux Planet
PHPBuilder
All Linux Devices
Technology Jobs

JustTechJobs.com

LinuxToday Newsletters
Server Daily
IT Management Daily
Subscribe News
Subscribe PR
Subscribe Security

internet.com
Internet News
Small Business

Advertise
Newsletters
Tech Jobs
E-mail Offers

 






Current Newswire:

Raspberry Pi benchmarked against Beagleboard, low price is long term

20 popular Ubuntu Linux apps you may want to try

A Selection of the Very Best Open Source Tutorials and Tools

Android Ice Cream Sandwich ported to x86 tablets, netbooks and notebooks

SECURITY: Google Chrome 17 Improves Security

How to read a CSV file in Perl?

Red Hat Brings Gluster to Amazon Cloud

New Linux kernel fixes power-saving issues

Using Wii remote with Android Device- Taking Gaming to the Next Level

Commercial Support now available for the open-source NGINX Web server



Applications Management Engineer Sr (NYC)
Next Step Systems
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume
:Simple Code To Implement C's stat() function On Linux And Unix
Simple Code To Implement C's stat() function On Linux And Unix
Mar 7, 2009, 16 :03 UTC (5 Talkback[s]) (7286 reads)

(Other stories by Mike Tremell)

[ Thanks to Mike Golvach for this link. ]

"The most interesting part for me was figuring out how to decipher the "file mode" information. If you check your system's "stat" manpage, you'll see that there are actually a good deal of macros already written-in that make printing out plain English file types and modes much simpler, but I decided to keep it cryptic. I take my modes like I take my permissions; in octal ;)

"Here's a sample run of the program - just using one file to make it simple (it should be noted, also, that you can only run this command against file types that you have permission to read. If you run this as your regular user on a file owned by root with 700 permissions, you'll get the "File or Directory Not Found!" error, which is, technically, incorrect. My God, am I a lazy C programmer. No wonder I get beat up so bad every time I goof around with it on here ;)"

Complete Story

Related Stories:
The Mouse That Roared: Killing A Sun Server During Lunch Break(Mar 05, 2009)
Subdomain Redirection Using htaccess And mod_rewrite On Apache For Linux Or Unix(Feb 28, 2009)
Back To Basics: Getting File Information Using Perl's Stat Function(Feb 26, 2009)
The Follow-Up: Absorption Of Knowledge In The Computer Age(Feb 20, 2009)
Simple Unix And Linux Shell Tricks To Save You A Few Gray Hairs(Feb 18, 2009)
Volume 3 Of The Linux/Unix SysAdmin Covert File Storage Method(Feb 12, 2009)


Index Mode   |   Flat Mode   |   Thread Mode   |   Thread Flat  
  Talkback(s) Name  and Date
So... I was expecting to see this guy *i ...   WTF   
jason
Mar 8, 2009, 14:07:37
 
> So... I was expecting to see this guy  ...   Re: WTF   
MikeTA
Mar 8, 2009, 19:50:56
 
[...].> He also leaks memory for all 4 o ...   Re: WTF   
Rainer Weikusat
Mar 8, 2009, 21:51:27
 
> [...]> .> > He also leaks memory for a ...   Re: Re: WTF   
Ken Jennings
Mar 9, 2009, 17:40:29
 
I believe the reason that the "ptr = (ch ...   Re: Re: slovenly malloc()ing   
Zartan
Mar 9, 2009, 23:46:22
 
  Home | Search Talkbacks | Customize View    Top of Page  



Enter your comments below:

* Your Name:

* Your Email Address:

* Subject:

CC: [will also send this talkback to an E-Mail address]

* Comments:

Tags allowed:<I>,<B> and <U>. See our talkback-policy for more about talkback content.

Fields marked with * are required!

..............................




All times are recorded in UTC.
Linux is a trademark of Linus Torvalds.
Powered by Linux, Apache and PHP