Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

How to determine access to file

This is a discussion on How to determine access to file within the C and C++ forums, part of the Software Development category; 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 ...

Go Back   Geeks Talk > Software Development > C and C++
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 07-16-2006
Expert Member
 
Join Date: Jul 2006
Posts: 101
Thanks: 0
Thanked 6 Times in 4 Posts
sripri is on a distinguished road
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?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-17-2006
Contributing Member
 
Join Date: Jul 2006
Posts: 77
Thanks: 0
Thanked 5 Times in 3 Posts
scott is on a distinguished road
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.
Reply With Quote
Reply

  Geeks Talk > Software Development > C and C++

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Listen to any PDF file!!! Shivanna Geeks Lounge 7 01-13-2009 09:18 AM
Database access using C program fred C and C++ 1 07-13-2006 10:52 PM
Oracle and MS Access Allan Paul Oracle 5 06-24-2006 01:53 PM
C Programming - File management in C Lokesh M C and C++ 0 05-31-2006 04:35 PM


All times are GMT -4. The time now is 04:34 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved