I have a program which I developed using the GNU compilers on a Linux system at home - which I expected I would be able to get to run quite readily on the AIX server at work.
But not to be.
Basically the program takes two parameters, one of which is a filename that is to be renamed and moved into a directory which is passed as the second parameter.
I am trying to use the 'access' function within unistd.h file to check that the file exists - and that the user has the correct permission to write/execute the parent directory in order for it to rename.
Works fine on Linux - but fails miserably on AIX!!
The line of code I'm using to check that the file exists is:
if (access (argv[1], F_OK) < 0)
and the code I'm using to check the permissions on the parent directory is:
if (access(argv[2], W_OK) < 0 ) || (access(argv[2], X_OK) < 0)...
Can anyone suggest why when I call 'access' I always get a -1 result - I even attempted to include the 'access.h' file but this hasn't worked either.
Any help would be much appreciated.
Regards
But not to be.
Basically the program takes two parameters, one of which is a filename that is to be renamed and moved into a directory which is passed as the second parameter.
I am trying to use the 'access' function within unistd.h file to check that the file exists - and that the user has the correct permission to write/execute the parent directory in order for it to rename.
Works fine on Linux - but fails miserably on AIX!!
The line of code I'm using to check that the file exists is:
if (access (argv[1], F_OK) < 0)
and the code I'm using to check the permissions on the parent directory is:
if (access(argv[2], W_OK) < 0 ) || (access(argv[2], X_OK) < 0)...
Can anyone suggest why when I call 'access' I always get a -1 result - I even attempted to include the 'access.h' file but this hasn't worked either.
Any help would be much appreciated.
Regards