File size: Difference between revisions

m
→‎{{header|REXX}}: aligned the output for the two input files, reduced the CHARIN size to allow PC/REXX and Personal REXX to execute.
m (→‎{{header|REXX}}: aligned the output for the two input files, reduced the CHARIN size to allow PC/REXX and Personal REXX to execute.)
Line 1,171:
=={{header|REXX}}==
===MS DOS version 1===
This REXX example was executed on a Windows/XP and also a Windows 7 system (in a DOS ''window'').,   and
<br>it reports the file's size (in bytes) for both of the required files.
 
Various REXXes were used for testing: &nbsp; '''Regina, &nbsp; PERSONAL REXX, &nbsp; PC/REXX,''' &nbsp; and &nbsp; '''R4'''.
<br>Note that some operating systems don't have a concept of a ''current directory'' or a ''file system root''.
 
<lang rexx>/*REXX program verifies a file's size (by reading all the lines) in current dir & root.*/
<br>Note that some operating systems don't have a concept of a &nbsp; ''current directory'' &nbsp; or a &nbsp; ''file system root''.
<lang rexx>/*REXX program verifiesdetermines a file's size (by reading all the linesdata) in current dir & root.*/
parse arg iFID . /*allow the user specify the file ID. */
if iFID=='' | iFID=="," then iFID='FILESIZinput.DATtxt' /*Not specified? Then use the default.*/
say 'size of' 'iFID "=" fileSizefSize(iFID) 'bytes' /*the current directory.*/
say 'size of \..\'iFID "=" fileSizefSize('\..\'iFID) 'bytes' /* " root " */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
fileSizefSize: parse arg f; $=0; do while lineschars(f)\==0; $ = $ + length( charin( f, , 1e4) )
end /*while*/; $=$+length(charin( call lineout f,,1e6)) /*close file.*/
return $</lang>
end /*while*/
'''{{out|output''' |text=&nbsp; when using the default input:}}
return $</lang>
'''output''' &nbsp; when using the default input:
<pre>
size of FILESIZ input.DATtxt = 240 bytes
size of \..\FILESIZinput.DATtxt = 540 bytes
</pre>
 
Line 1,216 ⟶ 1,218:
Note that CMS hasn't a concept of a ''root''.
<br>Also note that the CMS system doesn't normally support the use of periods ('''.'''); &nbsp; it uses blanks instead.
<lang rexx>/*REXX program verifiesdetermines a file's size (by reading all the linesdata) on the default mDisk.*/
parse arg iFID . /*allow the user specify the file ID. */
if iFID=='' | iFID=="," then iFID= 'FILESIZINPUT DATTXT' /*Not specified? Then use the default.*/
say 'size of' iFID "=" filesizefSize(iFID) 'bytes' /*on the default mDisk.*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
filesizefSize: parse arg f; $= 0; do while lines(f)\==0; $= $ + length( linein(f) )
end $=$+length(linein(f))/*while*/
return $</lang><br>
end /*while*/
return $</lang>
 
=={{header|Ring}}==