473,395 Members | 1,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

access() doesn't work when a file is open

Hi:

I am facing a strange problem.

I have opened a file "File1" using fopen() and while processing the
records in the file in a loop, I have a call to access() to check
existence of "File2". The reason is to stop processing further records
when the file "File2" exists. But the access() call fails when the file
"File1" is open.

If I close "File1" before making a call to access() on "File2", then it
works. Why is this behavior?

Please help. And please excuse my C ignorance.

Regds..Shyam

Nov 15 '05 #1
16 1286

ps**********@yahoo.com wrote:
Hi:

I am facing a strange problem.

I have opened a file "File1" using fopen() and while processing the
records in the file in a loop, I have a call to access() to check
existence of "File2". The reason is to stop processing further records
when the file "File2" exists. But the access() call fails when the file
"File1" is open.
Did you check for the error? aceess() on failure should set errno.
See if you can find out something. Guessing won't take us any further.
If I close "File1" before making a call to access() on "File2", then it
works. Why is this behavior?


No idea!

Nov 15 '05 #2
ps**********@yahoo.com wrote:

I have opened a file "File1" using fopen() and while processing
the records in the file in a loop, I have a call to access() to
check existence of "File2". The reason is to stop processing
further records when the file "File2" exists. But the access()
call fails when the file "File1" is open.

If I close "File1" before making a call to access() on "File2",
then it works. Why is this behavior?


There is no such function as access() in standard C, so it must be
something you wrote yourself or provided by your system. This
makes the subject off-topic here. You can either provide the full
source of access(), together with your actual code, when we will be
able to comment on it, or you should find a newsgroup that deals
with your system.

If you want to post a followup via groups.google.com, don't use the
broken "Reply" link at the bottom of the article. Click on "show
options" at the top of the article, then click on the "Reply" at
the bottom of the article headers.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 15 '05 #3
access() is an api available on Unix to determine accessibility of a
file. It is on all standard Unix flavors.

Nov 15 '05 #4
ps**********@yahoo.com writes:
I am facing a strange problem.

I have opened a file "File1" using fopen() and while processing the
records in the file in a loop, I have a call to access() to check
existence of "File2". The reason is to stop processing further records
when the file "File2" exists. But the access() call fails when the file
"File1" is open.

If I close "File1" before making a call to access() on "File2", then it
works. Why is this behavior?


access() is not defined by the C standard. Try comp.unix.programmer.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #5
ps**********@yahoo.com wrote
(in article
<11*********************@g43g2000cwa.googlegroups. com>):
access() is an api available on Unix to determine accessibility of a
file. It is on all standard Unix flavors.


Then one of the comp.unix.* newsgroups is probably a good place
to start, huh?
--
Randy Howard (2reply remove FOOBAR)

Nov 15 '05 #6
Suman wrote:
ps**********@yahoo.com wrote:
Hi:

I am facing a strange problem.

I have opened a file "File1" using fopen() and while processing the
records in the file in a loop, I have a call to access() to check
existence of "File2". The reason is to stop processing further records
when the file "File2" exists. But the access() call fails when the file
"File1" is open.


Did you check for the error? aceess() on failure should set errno.
See if you can find out something. Guessing won't take us any further.


Also take this to a group where it is topical please. access() is not
part of the C standard and may behave completely differently on
different implementations. It might, for example, try to open a
connection to an Access database.
If I close "File1" before making a call to access() on "File2", then it
works. Why is this behavior?


No idea!


At a guess there is some other problem with the code.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 15 '05 #7
On Fri, 26 Aug 2005 01:37:24 -0700, pshyamsunder wrote:
access() is an api available on Unix to determine accessibility of a
file. It is on all standard Unix flavors.


However comp.lang.c is not for discussing Unix APIs, a good place for that
is comp.unix.programmer.

Lawrence

Nov 15 '05 #8
On Fri, 26 Aug 2005 00:17:32 -0700, pshyamsunder wrote:
Hi:

I am facing a strange problem.

I have opened a file "File1" using fopen() and while processing the
records in the file in a loop, I have a call to access() to check
existence of "File2". The reason is to stop processing further records
when the file "File2" exists. But the access() call fails when the file
"File1" is open.

If I close "File1" before making a call to access() on "File2", then it
works. Why is this behavior?
First of all this is off-topic. And the second thing is your question is
too vague. You have not mentioned the error returned by access() call.
Please check man page, it contains a lot of information.

Please help. And please excuse my C ignorance.

Regds..Shyam


--
Hari

Nov 15 '05 #9
Suman wrote:
ps**********@yahoo.com wrote:

I have opened a file "File1" using fopen() and while processing
the records in the file in a loop, I have a call to access() to
check existence of "File2". The reason is to stop processing
further records when the file "File2" exists. But the access()
call fails when the file "File1" is open.


Did you check for the error? aceess() on failure should set errno.
See if you can find out something. Guessing won't take us any
further.
If I close "File1" before making a call to access() on "File2",
then it works. Why is this behavior?


No idea!


Please do not answer off-topic enquiries, other than to suggest an
appropriate newsgroup. One reason is that there is nobody here (in
principle) to criticize an off-topic reply content. Another is
that it clutters the newsgroup.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson

Nov 15 '05 #10

CBFalconer wrote:
Suman wrote:
[...]
Did you check for the error? aceess() on failure should set errno.
See if you can find out something. Guessing won't take us any
further.

[...]
Please do not answer off-topic enquiries, other than to suggest an
appropriate newsgroup. One reason is that there is nobody here (in
principle) to criticize an off-topic reply content. Another is
that it clutters the newsgroup.


It was my own way of saying, do the needful before posting, and also
an attempt to make the OP come back with *some* C code. Being rude
and showing him the door, was a possibility, but I did flirt a little
with rules, I suppose.

`fopen()': I believe is on-topic -- thence the gaul to take
such latitude.

Sometimes, the line is far too thin. For me.

Nov 15 '05 #11
ps**********@yahoo.com wrote:

access() is an api available on Unix to determine accessibility of a
file. It is on all standard Unix flavors.


I don't think you will go far. I gave you explicit instructions
about how to compose a reply in google groups, and you ignored them
and everything else I told you. This shows either an appalling
inability to learn or insufferable rudeness.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson

Nov 15 '05 #12
In article <43***************@yahoo.com>,
CBFalconer <cb********@worldnet.att.net> wrote:
ps**********@yahoo.com wrote:

access() is an api available on Unix to determine accessibility of a
file. It is on all standard Unix flavors.


I don't think you will go far. I gave you explicit instructions
about how to compose a reply in google groups, and you ignored them
and everything else I told you. This shows either an appalling
inability to learn or insufferable rudeness.


Or, ...

It shows that he just don't kowtow to you!

(And, why should he?)

Nov 15 '05 #13
Suman wrote:
CBFalconer wrote:
Suman wrote:
[...]
Did you check for the error? aceess() on failure should set errno. ^^^^^^^^
As far as I can see the above says access() NOT fopen()
See if you can find out something. Guessing won't take us any
further.
[...]
Please do not answer off-topic enquiries, other than to suggest an
appropriate newsgroup. One reason is that there is nobody here (in
principle) to criticize an off-topic reply content. Another is
that it clutters the newsgroup.


It was my own way of saying, do the needful before posting, and also
an attempt to make the OP come back with *some* C code.


When the problem, as in the OPs case, is a function that is OFF TOPIC
getting them to post it here is not appropriate.

If the OP can demonstrate a problem with only standard C functions then
*that* would have been on topic.
Being rude
and showing him the door, was a possibility,
Others redirected the OP moderately politely to other groups. Pointing
the OP at where the
but I did flirt a little
with rules, I suppose.
No, you talked about something completely off topic, namely access().
`fopen()': I believe is on-topic -- thence the gaul to take
such latitude.
The problem was access() failing, NOT fopen() failing, and your answer
was talking purely about access() NOT fopen().
Sometimes, the line is far too thin. For me.


I would have said it was rather obvious that if your answer is just
talking about a function outside the scope of this group, namely the
behaviour of access() in this case, that is was off topic.
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
Nov 15 '05 #14
In article <hj************@brenda.flash-gordon.me.uk>,
Flash Gordon <sp**@flash-gordon.me.uk> wrote:
(Blah, blah, blah, the typical verbal venting that passes for Flash's sex
life...)
(leading to...)
Sometimes, the line is far too thin. For me.


I would have said it was rather obvious that if your answer is just
talking about a function outside the scope of this group, namely the
behaviour of access() in this case, that is was off topic.


So, be a man! Do what Americans do! Sue him!

(Don't take being off-topic into your own hands. Take him to court!!!)

See ya in court!

Nov 15 '05 #15
Suman wrote:
gaul


ITYM gall

http://www.m-w.com/cgi-bin/dictionar...ionary&va=gall

2 : brazen boldness coupled with impudent assurance and insolence

--
pete
Nov 15 '05 #16

pete wrote:
Suman wrote:
gaul


ITYM gall


Trust me, it was a typoe!

Nov 15 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: chicha | last post by:
Hey people, I have to convert MS Access 2000 database into mysql database, the whole thing being part of this project I'm doing for one of my faculty classes. My professor somehow presumed I...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
1
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
17
by: DaveG | last post by:
Hi all I am planning on writing a stock and accounts program for the family business, I understand this is likely to take close to 2 years to accomplish. The stock is likely to run into over a...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
4
by: Bugs | last post by:
Hi everyone. I am trying to open a database which works fine using Access 2003, but when trying to open it on another PC that has Access 2002 I get the following error "This database is...
5
by: novak | last post by:
hi list, since a couple of weeks we face a special "security" problem. neraly every ms-access database that is located on our net-drives cannot be opened. when clicking the document's icon,...
9
by: O | last post by:
I need to do some lookups and updates on some legacy Access 2.0 files (they've from another vendor and I'm not in a position to update them). I was successful using VB6, but I've moved on to VS...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.