From: Gernot Frisch on

Hi,

I'm still using FILE* pF = fopen(filename, "wb"); for lots of stuff.
I also start processes using CreateProcess that work with files I've written.

Every now and then (quite frequently they say) there is an access denied error when sequentially accissing a file with a mixture
of fopen and CreateProcess.

What can that be, and how can I wait until a file is fully available?


Thank you,
------------------------------------
Gernot Frisch
http://www.glbasic.com

From: Matti Vuori on
"Gernot Frisch" <me(a)privacy.net> wrote in
news:88h2cvF1bjU1(a)mid.individual.net:
> I'm still using FILE* pF = fopen(filename, "wb"); for lots of stuff.
> I also start processes using CreateProcess that work with files I've
> written.
>
> Every now and then (quite frequently they say) there is an access
> denied error when sequentially accissing a file with a mixture of
> fopen and CreateProcess.
>
> What can that be, and how can I wait until a file is fully available?

CreateProcess? Do you mean CreateFile.

It is difficult to give any advice, when you don't tell the arguments you
use with CreateFile, as there are tons of alternatives. The most relevant
is the dwShareMode. You might need FILE_SHARE_READ | FILE_SHARE_WRITE
there.
From: Dee Earley on
On 24/06/2010 14:36, Matti Vuori wrote:
> "Gernot Frisch"<me(a)privacy.net> wrote in
> news:88h2cvF1bjU1(a)mid.individual.net:
>> I'm still using FILE* pF = fopen(filename, "wb"); for lots of stuff.
>> I also start processes using CreateProcess that work with files I've
>> written.
>>
>> Every now and then (quite frequently they say) there is an access
>> denied error when sequentially accissing a file with a mixture of
>> fopen and CreateProcess.
>>
>> What can that be, and how can I wait until a file is fully available?
>
> CreateProcess? Do you mean CreateFile.
>
> It is difficult to give any advice, when you don't tell the arguments you
> use with CreateFile, as there are tons of alternatives. The most relevant
> is the dwShareMode. You might need FILE_SHARE_READ | FILE_SHARE_WRITE
> there.

If your sharing options are "sensible" then the antivirus could also be
locking it.
Be sure to send them a complaint when you find out that is the case :)

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
From: Gernot Frisch on
"Matti Vuori" <xmvuori(a)kolumbus.fi> schrieb im Newsbeitrag news:Xns9DA1A8E5017CFxmvuorikolumbusfi(a)195.197.54.114...

> CreateProcess? Do you mean CreateFile.

No. I spawn some command line programs on that file. GCC and some of my own programs. Most of them use fopen(), too.
From: Charlie Gibbs on
In article <hvvu3t$pcu$1(a)speranza.aioe.org>, dee.earley(a)icode.co.uk
(Dee Earley) writes:

> On 24/06/2010 14:36, Matti Vuori wrote:
>
>> "Gernot Frisch"<me(a)privacy.net> wrote in
>> news:88h2cvF1bjU1(a)mid.individual.net:
>>
>>> I'm still using FILE* pF = fopen(filename, "wb"); for lots of stuff.
>>> I also start processes using CreateProcess that work with files I've
>>> written.
>>>
>>> Every now and then (quite frequently they say) there is an access
>>> denied error when sequentially accissing a file with a mixture of
>>> fopen and CreateProcess.
>>>
>>> What can that be, and how can I wait until a file is fully
>>> available?
>>
>> CreateProcess? Do you mean CreateFile.
>>
>> It is difficult to give any advice, when you don't tell the arguments
>> you use with CreateFile, as there are tons of alternatives. The most
>> relevant is the dwShareMode. You might need FILE_SHARE_READ |
>> FILE_SHARE_WRITE there.
>
> If your sharing options are "sensible" then the antivirus could also
> be locking it.
> Be sure to send them a complaint when you find out that is the case :)

I still use fopen() exclusively. Any problems I have turn out to
be overzealous antivirus programs or timed backups that try to lock
the files I want to use.

--
/~\ cgibbs(a)kltpzyxm.invalid (Charlie Gibbs)
\ / I'm really at ac.dekanfrus if you read it the right way.
X Top-posted messages will probably be ignored. See RFC1855.
/ \ HTML will DEFINITELY be ignored. Join the ASCII ribbon campaign!