BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

File is in use

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical
View previous topic :: View next topic  
Author Message
Peter Morris [Droopy eyes
Guest





PostPosted: Tue Jun 21, 2005 9:38 pm    Post subject: File is in use Reply with quote



I have a report which passes parameters to a calculation routine and
receives a set of results. The report executes this routine many times, the
routine takes about 100 milliseconds to run.

For tracking purposes, every time I run the routine I write the parameters
to a text file using a TStringList. My problem is that rarely I get an
exception from the SaveToFile method telling me that the file is in use.

Has anyone else experienced this? If so do you have a solution?

Thanks


--
Pete
====
ECO Modeler, Audio compression components, DIB graphics controls,
FastStrings
http://www.droopyeyes.com

Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/


Back to top
Jan Derk
Guest





PostPosted: Tue Jun 21, 2005 10:47 pm    Post subject: Re: File is in use Reply with quote



Peter Morris [Droopy eyes software] wrote:
Quote:
I have a report which passes parameters to a calculation routine and
receives a set of results. The report executes this routine many times, the
routine takes about 100 milliseconds to run.

For tracking purposes, every time I run the routine I write the parameters
to a text file using a TStringList. My problem is that rarely I get an
exception from the SaveToFile method telling me that the file is in use.

Has anyone else experienced this? If so do you have a solution?

I have seen this happening due to anit-virus software locking the file
for a tiny moment, but long enough for your software to fail.

Resolution #1: Burn down the Symantec headquarters.

Resolution #2: Retry accessing the file after a short moment. Generally
the anti-virus S/W unlocks the file when its done.

The file extension has an influence. *.dat file for example get checked,
thus locked, by Norton, but *.weirdextension often isn't. So often
changing the file extension helps. It does not hurt either to not
release the file lock while you need it, preventing any other
application from grabbing it.

Jan Derk

Back to top
Erwien Saputra
Guest





PostPosted: Wed Jun 22, 2005 4:58 am    Post subject: Re: File is in use Reply with quote



Peter Morris [Droopy eyes software] wrote:
Quote:

Has anyone else experienced this? If so do you have a solution?

1. Check for the file before trying to write it. If the file is
locked, generate another file name.

2. Lock the file all the time.

Usually I do not recommend locking the file all the time, but since
your routine gets called alot, probably it is a solution.

Wien.

--
http://blogs.slcdug.org/esaputra
Delphi Setting Manager - http://www.codeline.net

Back to top
Kyle A. Miller
Guest





PostPosted: Wed Jun 22, 2005 5:28 pm    Post subject: Re: File is in use Reply with quote

Peter Morris [Droopy eyes software] wrote:
Quote:
Has anyone else experienced this? If so do you have a solution?

Try Raize CodeSite. Great software. Supports .NET too.

http://www.raize.com/DevTools/CodeSite/Default.asp

Back to top
Peter Morris [Droopy eyes
Guest





PostPosted: Wed Jun 22, 2005 9:58 pm    Post subject: Re: File is in use Reply with quote

I don't understand how CodeSite will help me :-)


Back to top
Sanford Aranoff
Guest





PostPosted: Mon Jun 27, 2005 12:50 pm    Post subject: Re: File is in use Reply with quote



"Peter Morris [Droopy eyes software]" wrote:

Quote:
I have a report which passes parameters to a calculation routine and
receives a set of results. The report executes this routine many times, the
routine takes about 100 milliseconds to run.

For tracking purposes, every time I run the routine I write the parameters
to a text file using a TStringList. My problem is that rarely I get an
exception from the SaveToFile method telling me that the file is in use.


I would write to a database. Much more reliable than a text file.



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Non-Technical All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.