GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Operating System  >  Unix Programming

 Print  |  
Question:  What is the use of stat()?



June 06, 2007 08:52:56 #1
 Gopi K   Member Since: Visitor    Total Comments: N/A 

RE: What is the use of stat()?
 

#include <sys/types.h>

#include <sys/stat.h>

int stat(const char *path, struct stat *buf);


The stat() function obtains information about the named file and

writes it to the area pointed to by the buf argument. The path

argument points to a pathname naming a file. Read, write or execute

permission of the named file is not required, but all directories

listed in the pathname leading to the file must be searchable. An

implementation that provides additional or alternate file access

control mechanisms may, under implementation-dependent conditions,

cause stat() to fail.

     

 

Back To Question