Hi Rory, I took a very quick look and the code is in OOps/dumpf.c. All of the file code looks like it is opening with "rb" or "wb" depending on reading or writing. I don't know c file handling very well, but looking at manuals I wonder if using r+b and w+b might be a possible solution? Otherwise though, it seems using files for this kind of thing could be sort of tricky. steven On Wed, Feb 27, 2008 at 3:48 AM, Rory Walsh wrote: > The following instrument and UDO write data to a text file and then > after 5 seconds should read the data back. The thing is the instrument > simply stops after 5 seconds. I'm pretty sure that the file is not being > released after dumpk writes to it and as a result readk fails. If there > any way around this? I want to periodically write and read control data > during an instruments performance, can this be done using readk and dump k? > > Rory. > > > > > > -odevaudio -b10 -idevaudio > > > sr = 44100 > ksmps = 4410 > nchnls = 1 > > opcode dataRW, k, Ski > Sname, kvalue, iRW xin > kout init 0 > if (iRW==0) then > dumpk kvalue, Sname, 8, 0 > kout = kvalue > else > kres readk Sname, 8, 0 > kout = kres > endif > xout kout > endop > > instr 1 > kline line 0, p3, p3 > if(kline < 5) then > printks "writing", 0 > k1 dataRW "test.txt", kline, 0 > elseif(kline > 5) then > printks "reading", 0 > k1 dataRW "test.txt", kline, 1 > endif > > printk2 k1 > endin > > > > f1 0 1024 10 1 > i1 0 15 > > > > > Send bugs reports to this list. > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" >