Anonymous user
Truncate a file: Difference between revisions
Added BBC BASIC
m (→{{header|D}}) |
(Added BBC BASIC) |
||
Line 94:
See also: [[#Liberty BASIC|Liberty BASIC]], [[#PowerBASIC|PowerBASIC]], [[#PureBasic|PureBasic]], [[#ZX Spectrum Basic|ZX Spectrum Basic]].
=={{header|BBC BASIC}}==
This will extend the file if the specified length is greater than the existing length. A test to prevent that could easily be added.
<lang bbcbasic> DEF PROCtruncate(file$, size%)
LOCAL file%
file% = OPENUP(file$)
IF file%=0 ERROR 100, "Could not open file"
EXT#file% = size%
CLOSE #file%
ENDPROC</lang>
=={{header|C}}==
|