[LC++]Distinguishing between a file and a directory

Krishna Monian k_tutorials at yahoo.com
Fri Jul 16 04:22:01 UTC 2004


Is there any other way to do this? Since calling stat
will result in the open operation slowing down
significantly (at least I think it would. Please
correct me if I am wrong on this).

Thanks
Krishna

--- Jack Lloyd <lloyd at acm.jhu.edu> wrote:
> 
> Yes, because the argument to open(2) is the
> pathname, thus you can stat(2) it
> and see what kind of file it is.
> 
> -J
> 
> On Thu, Jul 15, 2004 at 11:16:42AM -0700, Krishna
> Monian wrote:
> > Hi All, 
> > 
> > Is there any way to distinguish whether a file
> being
> > opened is an ordinary file or a directory using
> the
> > information passed to the open system call?
> > 
> > Thanks
> > Krishna
> > 
> > 
> > 	
> > 		
> > __________________________________
> > Do you Yahoo!?
> > New and Improved Yahoo! Mail - 100MB free storage!
> > http://promotions.yahoo.com/new_mail 
> > _______________________________________________
> > This is the Linux C++ Programming List
> > :
> http://lists.linux.org.au/listinfo/tuxcpprogramming
> List
> _______________________________________________
> This is the Linux C++ Programming List
> :
> http://lists.linux.org.au/listinfo/tuxcpprogramming
> List
> 



	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 



More information about the tuxCPProgramming mailing list