Re: Testing if a file or directory exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Agreed, by definition access() does the following:

	access() checks whether the process would be allowed to read, write or test for
existence of the file (or other file system object) whose name is pathname.


LDB

Benoit Rouits wrote:
> I think, as information are not needed, even access() is better than
> stat() and also uses less memory/cpu.
> - ben
> Le dimanche 09 septembre 2007 à 06:07 -0400, Robert P. J. Day a écrit :
>> if all you want to do is check for existence, then, execution time
>> notwithstanding, you should use the method which accomplishes that and
>> nothing more, so the obvious solution would be stat().
>>
>> it would be illogical to call open() since a side-effect would be that
>> you then had an open file.  in short, if you just want to test, then
>> just test. 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux