[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

mktemp/mkstemp

Andrew Walrond

4/18/2005 9:31:00 AM

Is this functionality available somewhere? I can't find it...

TIA

Andrew Walrond


2 Answers

mark sparshatt

4/18/2005 9:56:00 AM

0

Andrew Walrond wrote:
> Is this functionality available somewhere? I can't find it...
>
> TIA
>

The Tempfile class should do what you want

(taken from the Pickaxe II)

require "tempfile"

tf = TempFile.new("afile")
tf.path #=> "/tmp/afile28519.0"
tf.puts("Cosi Fan Tutte")
tf.close

HTH

--
mark sparshatt



Andrew Walrond

4/18/2005 10:05:00 AM

0

On Monday 18 April 2005 10:56, mark sparshatt wrote:
> Andrew Walrond wrote:
> > Is this functionality available somewhere? I can't find it...
> >
> > TIA
>
> The Tempfile class should do what you want
>

I'd looked at that, but the file gets deleted when the Tempfile object is
finalised. I want the file to stick around after my ruby script exits.

Andrew