[PD] Reading and writing binary files

Mathieu Bouchard matju at artengine.ca
Mon Feb 28 03:31:39 CET 2011


On Sun, 27 Feb 2011, David wrote:

> I have another question, though. How do the files get closed? When you 
> exit PureData? Does that mean that every time you open a file, another 
> system file handle is used and not released until you exit PureData? Or 
> is there some way to explicitly close the file and release the file 
> handle, buffers, etc.?

This depends on every object class.

In the case of [binfile] [textfile] [qlist] [soundfiler], the 'read' 
method copies the whole file to RAM and closes immediately the filehandle.

In the case of [#io.grid] ([#in grid]) and video readers, there is 'open'
and there is 'close'.

In [readsf~] it's slightly different, as 'stop' or '0' implies closing, 
but it's not documented as such in Miller's manual. The structure of 
'open' followed by 'start'/'1' and then 'stop'/'0' would suggest that 
there is a separate 'close', and thus that after a stop you'd be able to 
resume without reopening, but this is not the case. (!!!)

GridFlow's 'load' in image readers is just a shortcut for an 'open' 'bang' 
'close' sequence.

I think I remember that someone has found a filehandle leak bug somewhere 
in Pd, but I don't recall what that was. Anyone remembers ?

  _______________________________________________________________________
| Mathieu Bouchard ---- tél: +1.514.383.3801 ---- Villeray, Montréal, QC


More information about the Pd-list mailing list