-
Contributing Member
How to determine access to file
Is there any predefined function or command in C to determine whether the user say userid has access to a file or not. I want to perform this check and based on the result I want to give actions. How to achieve this?
-
Contributing Member
Re: How to determine access to file
In C programming there is UNIX system call named as access() to achieve the purpose stated by you.
The syntax of the function access () is as follows:
int access(char *path, int mode)
This determines the accessibility of file in the pointed pathname for the mode as defined. The return value of the function access () is 0 if the operation is successful. The function returns -1 in case of error and also returns an errno to indicate the error.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules