Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Temporary Files

Reply
Thread Tools

Temporary Files

 
 
Harsh Vardhan Singh
Guest
Posts: n/a
 
      03-03-2005
hi,

i am trying to create a temporary file associated with a particular process.
For instance, i have a windows application which will create a temp file as
soon as it this program is executed. Now i want this temp file to be
destroyed if this application is closed / crashes. Is this possible?

Please help.
Thanks in advance,
Harsh


 
Reply With Quote
 
 
 
 
richlm
Guest
Posts: n/a
 
      03-03-2005
Does it need to be a physical file on disk?
If not, maybe you could use MemoryStream?


 
Reply With Quote
 
 
 
 
Harsh Vardhan Singh
Guest
Posts: n/a
 
      03-04-2005
yes it has to be on the physical disk.. i think it wud help if i explain
what i am trying to do... basically i hv to prevent a file from being
accessed by two users (on different pcs) simultaneously.. so i want to
create a temp file as soon as one user accesses that file.. now when someone
else tries to open it, i first check if the temp file is present or not...

now the problem is removing the temp file in case the program crashes... coz
if the file is not removed then no user will be able to access it unless the
temp file is manually deleted.

this is why i wanted to know if there can be temp files created and
destroyed along with a process.

harsh.

"richlm" <(E-Mail Removed)> wrote in message
news:%23SJ3%(E-Mail Removed)...
> Does it need to be a physical file on disk?
> If not, maybe you could use MemoryStream?
>



 
Reply With Quote
 
Flip
Guest
Posts: n/a
 
      03-04-2005
Does this help?
http://www.knowdotnet.com/articles/tempfiles.html

Here's a manage C++ example. Not perfect but helps a bit.
http://www.codeguru.com/Cpp/Cpp/cpp_...cle.php/c9255/

I believe I've done this with java before, but unsure how to do it in C#, so
I just googled it. I still have to finish reading the article myself
(sorry), but I'll do that when I get my coffee (right now :>).

HTH.



 
Reply With Quote
 
Amit Bahree
Guest
Posts: n/a
 
      03-09-2005
If you need to create more than one file, then you can use
TempFileCollection class found in the System.CodeDom.Compiler namespace.
On MSDN (installed locally) you can find out more at
ms-help://MS.VSCC.2003/MS.MSDNQTR.2005JAN.1033/cpref/html/frlrfsystemcodedomcompilertempfilecollectionclasst opic.htm

HTH,
Amit.

"Flip" <[remove_me](E-Mail Removed)> wrote in message
news:[remove_me](E-Mail Removed):

> Does this help?
> http://www.knowdotnet.com/articles/tempfiles.html
>
> Here's a manage C++ example. Not perfect but helps a bit.
> http://www.codeguru.com/Cpp/Cpp/cpp_...cle.php/c9255/
>
> I believe I've done this with java before, but unsure how to do it in C#, so
> I just googled it. I still have to finish reading the article myself
> (sorry), but I'll do that when I get my coffee (right now :>).
>
> HTH.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: copy some files from IE temporary internet files Tim Golden Python 0 04-19-2010 12:29 PM
What are the files in folder Temporary ASP.NET Files AAaron123 ASP .Net 3 11-04-2008 11:53 PM
anonymous array of strings // ("taking address of temporary"- how long is temporary valid?) anon.asdf@gmail.com C++ 7 02-12-2008 10:58 AM
Temporary ASP.NET files not auto-updated when files change? yashgt@gmail.com ASP .Net 1 02-22-2007 04:29 PM
Account that creates folders and files under Temporary Internet files rogersw8n@gmail.com ASP .Net 5 01-26-2007 06:54 PM



Advertisments