Home | OS/2 Software | Rexx | Read a file into a variable quickly

Read a file into a variable quickly

Contributed by: Wayne Swanson

This pretty simple and quite common but I'm sure there are people still using Linein in some cases that they really don't need to and from my experience using Charin is always much faster. This snippet will read the file and close it after the read. The variable "value" holds all the file contents.


 


/* Charin file to a variable */
value = CHARIN(filename,1,CHARS(filename))
rc=STREAM(filename,'c','close')