Re: [Oorexx-devel] How about adding class methods arrayIn and arrayOut on the Stream class ?

2024-06-16 Thread Gilbert Barmwater
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

Re: [Oorexx-devel] How about adding class methods arrayIn and arrayOut on the Stream class ?

2024-06-16 Thread Jeremy Nicoll
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

Re: [Oorexx-devel] How about adding class methods arrayIn and arrayOut on the Stream class ?

2024-06-16 Thread Gilbert Barmwater
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

Re: [Oorexx-devel] How about adding class methods arrayIn and arrayOut on the Stream class ?

2024-06-16 Thread Rony G. Flatscher
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

Re: [Oorexx-devel] How about adding class methods arrayIn and arrayOut on the Stream class ?

2024-06-16 Thread Rony G. Flatscher
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

Re: [Oorexx-devel] How about adding class methods arrayIn and arrayOut on the Stream class ?

2024-06-15 Thread Rick McGuire
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

Re: [Oorexx-devel] How about adding class methods arrayIn and arrayOut on the Stream class ?

2024-06-15 Thread Gilbert Barmwater
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

[Oorexx-devel] How about adding class methods arrayIn and arrayOut on the Stream class ?

2024-06-15 Thread Rony G. Flatscher
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