473,799 Members | 3,132 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1311

ps**********@ya hoo.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**********@ya hoo.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.c om, 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********@yah oo.com) (cb********@wor ldnet.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**********@ya hoo.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.progr ammer.

--
Keith Thompson (The_Other_Keit h) 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**********@ya hoo.com wrote
(in article
<11************ *********@g43g2 000cwa.googlegr oups.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**********@ya hoo.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.progr ammer.

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**********@ya hoo.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.c om, 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

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

Similar topics

17
2910
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 knew db's and gave me long list of things to do with that particular database, first thing being that particular conversion. Truth is that I don't know a first thing about db's, let alone using mysql... I downloaded mysql form www.mysql.com and...
6
4763
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 appreciated. Thanks in advance
4
3539
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 objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
1
650
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 objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
17
2498
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 thousand items and the accounting side will be used for hopefully many years so the entries are likely to be vast. The delema is what is best to use ase the DB engine, Access I have as part of Office 2002 or should I really be looking at SQL...
9
3845
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 site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
18
9156
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 page "How to: Connect to Data in an Access Database"
4
2596
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 unrecognised file format, it may have been created with a later version of Access, upgrade to a later version..." Could anyone please help to resolve this issue.
5
2237
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, first, the warning message arises "open document - security message" - "Really open *.mdb ....?", second, when clicking "start" ms-access starts, but the mdb-file cannot be opened. message: "ms-access could not open the file ... The
9
2425
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 2005 and ADO and having some serious problems. Here's the scenario: 2 people have the same Access 2.0 databases running in the Access 2.0 application.
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9538
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10470
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10247
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10214
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10023
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5583
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.