On 6/16/2024 1:57 PM, Jeremy Nicoll wrote:
On Sun, 16 Jun 2024, at 13:42, Gilbert Barmwater wrote:
But it doesn't close the file. And there is no way to close it after
that statement since there is no reference to the stream object. Now,
in most cases, not closing the stream is not a problem a
On Sun, 16 Jun 2024, at 13:42, Gilbert Barmwater wrote:
> But it doesn't close the file. And there is no way to close it after
> that statement since there is no reference to the stream object. Now,
> in most cases, not closing the stream is not a problem as ooRexx will do
> it when the progra
But it doesn't close the file. And there is no way to close it after
that statement since there is no reference to the stream object. Now,
in most cases, not closing the stream is not a problem as ooRexx will do
it when the program ends. But if you need to access the same file again
later in
On 16.06.2024 02:02, Rick McGuire wrote:
Um,
a = .stream~new(filename)~arrayin
is a one liner that reads into an array.
Yes, that is the beauty of cascading messages! However, the file needs to be closed (e.g. if one
wishes to replace it later) which is not possible in the same line, rather
On 16.06.2024 01:49, Gilbert Barmwater wrote:
First let me offer the following way to write the contents of an array to a stream that only
requires a single line:
.stream~new(streamFileName)~~arrayOut(arr [,Lines|Chars])~close
Unfortunately, there is no corresponding "one-liner" for reading
Um,
a = .stream~new(filename)~arrayin
is a one liner that reads into an array.
Rick
On Sat, Jun 15, 2024 at 7:50 PM Gilbert Barmwater
wrote:
> First let me offer the following way to write the contents of an array to
> a stream that only requires a single line:
>
> .stream~new(streamFileName
First let me offer the following way to write the contents of an array
to a stream that only requires a single line:
.stream~new(streamFileName)~~arrayOut(arr [,Lines|Chars])~close
Unfortunately, there is no corresponding "one-liner" for reading the
contents of a stream into an array. This l
The Stream class has the handy instance methods arrayIn and arrayOut.
To read the content of a stream into an array the following statements are
necessary:
s=.stream~new(streamFileName)
s~open( [read|both] )
arr=s~arrayIn( [Lines|Chars] )
s~close
To write the content of an array in