mysterious sharingViolation using a CStdioFile

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?
tullheadAsked:
Who is Participating?
 
snoeglerConnect With a Mentor Commented:
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
 
tullheadAuthor Commented:
Oh yeah -- what is this "SHARE.EXE" that the documentation
mentions??
0
 
job_sCommented:
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
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
muneeb_baigCommented:
Please use CFile::shareDenyNone in Open method.  
0
 
DanRollinsCommented:
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
 
snoeglerCommented:
Are you using Norton AV (or any other online scanner)?
0
 
tullheadAuthor Commented:
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
 
tullheadAuthor Commented:
Thanks snoegler -- you get the points
0
 
snoeglerCommented:
Thx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.