Re: [Oorexx-devel] Reusing an instance of the .Stream class

2021-11-01 Thread Rick McGuire
Taking a quick look at the code, reusing the stream object will cause a memory leak and potentially leave you with open file handles. Rick On Sat, Oct 30, 2021 at 11:28 AM Erich Steinböck wrote: > can I reuse fileStream somehow? There seems to be no way to associate >> fileStream with a

Re: [Oorexx-devel] Reusing an instance of the .Stream class

2021-10-30 Thread Rick McGuire
On Sat, Oct 30, 2021 at 11:28 AM Erich Steinböck wrote: > can I reuse fileStream somehow? There seems to be no way to associate >> fileStream with a different file >> > Hi Leslie, > in fact this can be done by calling INIT directly. > > ~~~ > s = .Stream~new("") > do i = 1 to 99 > s~init(i) >

Re: [Oorexx-devel] Reusing an instance of the .Stream class

2021-10-30 Thread Erich Steinböck
> > can I reuse fileStream somehow? There seems to be no way to associate > fileStream with a different file > Hi Leslie, in fact this can be done by calling INIT directly. ~~~ s = .Stream~new("") do i = 1 to 99 s~init(i) s~~open("write replace")~~charOut(i)~close end ~~~ I occasionally

Re: [Oorexx-devel] Reusing an instance of the .Stream class

2021-10-29 Thread Sahananda Sahananda
Hi Leslie, Why would you want/need to do that? Jon On Fri, 29 Oct 2021 at 02:18, J Leslie Turriff wrote: > Supposing I want to write several different files, one after > another. I would use a > sequence like > > | fileName1 = 'file1.txt' > | fileStream = .Stream ~ new(fileName) > |

[Oorexx-devel] Reusing an instance of the .Stream class

2021-10-28 Thread J Leslie Turriff
Supposing I want to write several different files, one after another. I would use a sequence like | fileName1 = 'file1.txt' | fileStream = .Stream ~ new(fileName) | fileStream ~ open(write replace) | fileStream ~ arrayOut(someArray) | fileStream ~ close for the first file. Now, do I