Solved

mysterious sharingViolation using a CStdioFile

Posted on 2002-04-19
9
578 Views
Last Modified: 2013-11-20
My app writes several ascii files (I use CStdioFile) and
generally things work fine.  But I have intermittent
mysterious problems where things fail, and the CFileException that comes back has "sharingViolation" in
its "m_cause" member.

Looking at some doc for this it says:

"SHARE.EXE was not loaded, or a shared region was locked"

Now my file is a simple file on the local disk, not in
a shared folder or having anything to do with sharing as
far as I can tell.  I'm on XP (haven't seen it on other
computers, but who knows...)

Do you get a sharingViolation is the file is still open
from a previous action?  But I think I always close the
file, so I don't get what the problem can be.

Any ideas?
0
Comment
Question by:tullhead
9 Comments
 

Author Comment

by:tullhead
ID: 6955483
Oh yeah -- what is this "SHARE.EXE" that the documentation
mentions??
0
 
LVL 3

Expert Comment

by:job_s
ID: 6955825
Are U sure U r closing the file after operation?
Be sure that.Problem because of someone opens that file.

Or try |CFile::shareDenyNone flag




0
 

Expert Comment

by:muneeb_baig
ID: 6957407
Please use CFile::shareDenyNone in Open method.  
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 6964836
hi muneeb_baig,
Please don't post Answers.  The experts in this Topic area have agreed to post Comments so that the asker can get more, and more varied responses from the Experts.

So in the future, please post comments like everyone else.  Thanks!

-- Dan
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 6

Expert Comment

by:snoegler
ID: 6977711
Are you using Norton AV (or any other online scanner)?
0
 

Author Comment

by:tullhead
ID: 6977870
I've got Norton AV there, I believe...
could that be related?

Actually, on that same computer I also have occaisional
glitches where it says it can't open a file (in genreal
problems with file access) -- this occurs even from apps
like the visusal studio editor -- then, a second later
all if fine.

Hmmm....
0
 
LVL 6

Accepted Solution

by:
snoegler earned 200 total points
ID: 6977907
Yup, this is caused by NAV (NAV recognizes that a file gets modified and tries to grasp & check the file before you do). Disable NAV's online scanning and the problems will be gone (there was already a similar thread here).
0
 

Author Comment

by:tullhead
ID: 6978150
Thanks snoegler -- you get the points
0
 
LVL 6

Expert Comment

by:snoegler
ID: 6978229
Thx
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 67
Unix / Linux grid computing 5 127
if loop in java 3 114
centeredAverage challenge 8 122
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now