[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lifetime of variables and .oct files

From: Pascal Fleury
Subject: Lifetime of variables and .oct files
Date: Wed, 31 Jan 2001 21:43:31 +0900

Hi there !

I have an .oct file in which I open a file, and get the file descriptor
for it. This has to be given to subsequent accesses to the function in
the .oct file. So I can open a file, and make multiple accesses from
octave scripts to get chunks of the data in the file. Example:

infile = opensndfile("mysound.aiff")     # opens a file, creates some
structure in memory within the .oct file
chunk1 = readsndblock(infile, 1024) # reads 1024 samples
chunk2 = readsndblock(infile, 1024) # read the following 1024 samples
infile = 2 # Here: the file should be closed, and the memory released in
the .oct file

But I do not know when I can close the file and remove the info in
memory, as this should be done ideally when the variable goes
out-of-scope or stops living within Octave (e.g. infile gets assigned a
new value). Is there a way of knowing this in the .oct file ? Am I
guaranteed that the .oct file will not be unloaded before this happens ?
Or is my complete design wrong ?

Thanks for any help,

Attachment: p.fleury.vcf
Description: Card for Pascal Fleury

reply via email to

[Prev in Thread] Current Thread [Next in Thread]