which C function is best to check for directory EXISTANCE?
Karl Vogel
vogelke+unix at pobox.com
Wed Dec 19 03:40:11 UTC 2012
>> On Tue, 18 Dec 2012 16:26:10 -0800,
>> Gary Kline <kline at thought.org> said:
G> which C function is best to check for the existence of a *directory*?
G> say that I am want to make postitve that "/tmp/foo/" exists. ALso:
G> which will make sure that the directory AND file
G> "tmp/foo/filename12345" exists and that I have read access to it?
I'd just call open() with O_RDONLY and if it fails, check errno for
EACCESS (you don't have permission) or ENOENT (doesn't exist).
--
Karl Vogel I don't speak for the USAF or my company
USELESS PHRASES WHEN SPEAKING TO A COP #9:
"You're not gonna check the trunk, are you?"
More information about the freebsd-questions
mailing list