[Tutor] Checking for file existence

Tim Johnson tim@johnsons-web.com
Sat, 24 Feb 2001 10:38:41 -0900

Hello Deirdre
On Sat, 24 Feb 2001, you wrote:
> On Sat, 24 Feb 2001, Tim Johnson wrote:
> > Python newbie here.... I'm checking documentation, but can't
> > find anything like the C access() function.
I've earned a living programming in C for some years now...... :)
> > Is such a function available.
> What are you trying to do?
Check for the existence of a specific file name, 
before attempting to open it.
> access() is NOT a function of the C language.
Respectfully, I must differ with the statement above
with these qualifications:
1) I do not believe that access() is a *ansi* standard, but is used by most
windows compilers. 
2) I have recently switched to Linux, haven't run any C
code on this machine yet, but 
$ man access
       #include <unistd.h>
       int access(const char *pathname, int mode);

same prototype as is on dos/borland compiler

Tim Johnson
"Of all manifestations of power,
 restraint impresses the most."