Results 1 to 2 of 2

Thread: How to determine access to file

  1. #1
    Contributing Member
    Join Date
    Jul 2006
    Answers
    93

    Question 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?


  2. #2
    Contributing Member
    Join Date
    Jul 2006
    Answers
    74

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact