Solved

mysterious sharingViolation using a CStdioFile

Posted on 2002-04-19
9
586 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Separate into files by filename 12 92
Define unique primary key 9 100
Doc'in system (example?) BA 7 127
wordappend challenge 8 249
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

751 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