Geeks Talk

Prepare for your Next Interview




Difference between stat, fstat, lstat

This is a discussion on Difference between stat, fstat, lstat within the C and C++ forums, part of the Software Development category; Can someone tell me the difference between stat, fstat, lstat. Also tell me whether it is possible to use stat() only in Linux or Unix environment or is it possible ...


Go Back   Geeks Talk > Software Development > C and C++

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 06-29-2006
Contributing Member
 
Join Date: May 2006
Posts: 79
Thanks: 0
Thanked 5 Times in 4 Posts
fred is on a distinguished road
Difference between stat, fstat, lstat

Can someone tell me the difference between stat, fstat, lstat. Also tell me whether it is possible to use stat() only in Linux or Unix environment or is it possible to use it even in Windows environment.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-29-2006
Contributing Member
 
Join Date: May 2006
Posts: 84
Thanks: 0
Thanked 9 Times in 6 Posts
timmy is on a distinguished road
Re: Difference between stat, fstat, lstat

As far as the working of stat with windows I am sure that it would work with windows. As far as the functionality of stat() is considered it takes the syntax as
int stat(const char *path, struct stat *buf);
The function is used to return information about a file. The file referred is pointed in path and the value is filled in buf mentioned above.
Reply With Quote
  #3 (permalink)  
Old 06-29-2006
Contributing Member
 
Join Date: May 2006
Posts: 73
Thanks: 0
Thanked 4 Times in 4 Posts
joel is on a distinguished road
Re: Difference between stat, fstat, lstat

Some of the diffrence between stat(),fstat() and lstat() is
For stat() and lstat() serach permission is needed in the path mentioned in the file to perform their operation but it is not so in case of fstat()
In lstat() it is possible to put symbolic link and if the mentioned object is symbolic link the path is considered fully and not the file alone as in case of stat()
fstat() performs the same functionality but by making use of the concept of file descriptors. If there is any other difference put your discussion to envisage knowledge
Reply With Quote

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved