Truncate a file: Difference between revisions

removed wrong try :-(
m (→‎REXX version 2: state environments)
(removed wrong try :-()
Line 724:
 
=={{header|REXX}}==
===version 1===
<lang rexx>/*REXX program truncates a file to a specified number of bytes. */
parse arg siz FID /*get arguments from the C.L. */
Line 760 ⟶ 759:
file AA.AA truncated to 333 bytes.
</pre>
===version 2===
<lang rexx>/*REXX program truncates a file to a specified number of bytes. */
parse arg siz FID /*get arguments from the C.L. */
FID=strip(FID) /*strip leading/trailing blanks. */
if FID=='' then call ser "No fileID specified"
if \datatype(siz,'W') then call ser "trunc size isn't an integer: " siz
if siz<1 then call ser "trunc size isn't a positive integer"
call charout Fid,'',222
call lineout Fid /* close the file */</lang>
Tested with ooRexx and Regina on Windows 8.1
 
=={{header|Ruby}}==
2,298

edits