On 11/05/2016 15:01, Valentin Ryckewaert wrote:
> Hello everyone,
> 
> I would like to use a temporary file for a project and I didn't find an
> existing method.
> I'm asking my self if it's a better idea to use ffi or OSSubProcess (or
> something already build for it) to build a method able to create this
> tmp file.
> Someone could help me please?
> 
> PS : Should it be a good idea to add this method directly in Pharo ?

Hi,

For temporary files you can create a new file in memory via `FileSystem
memory` so you do not pollute your file system and the file will be
deleted later since the memory is volatile.

`file := FileSystem memory / 'tmp.txt'.
file ensureCreateFile.
file writeStreamDo: [ :s | s nextPutAll: 'Hello World' ].`

-- 
Cyril Ferlicot

http://www.synectique.eu

165 Avenue Bretagne
Lille 59000 France

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to