Rexx - chars
This function returns either 1 or the number of characters left to read in the file itself. The filename is mentioned as a parameter to the function.
Syntax
chars(filename)
Parameters
filename − This is the name of the file for which the end of file needs to be determined.
Return Value
This function returns either 1 or the number of characters left to read in the file itself.
Example
/* Main program */ str = '' do j = 1 while chars(Example.txt) > 0 str = ' ' (charin(Example.txt)) call charout ,str end
The following things need to be noted about the above program −
First a string variable is assigned to a null value.
Then the do loop is used to read each character at a time.
Each character is read and then sent to the console.
When we run above program we will get the following result.
Output
E x a m p l e 1 E x a m p l e 2 E x a m p l e 3
rexx_functions_for_files.htm
Advertisements