Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Truncate-a-file/PowerBASIC/truncate-a-file.basic
Normal file
17
Task/Truncate-a-file/PowerBASIC/truncate-a-file.basic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
SUB truncateFile (file AS STRING, length AS DWORD)
|
||||
IF LEN(DIR$(file)) THEN
|
||||
DIM f AS LONG
|
||||
f = FREEFILE
|
||||
OPEN file FOR BINARY AS f
|
||||
IF length > LOF(f) THEN
|
||||
CLOSE f
|
||||
ERROR 62 'Input past end
|
||||
ELSE
|
||||
SEEK f, length + 1
|
||||
SETEOF f
|
||||
CLOSE f
|
||||
END IF
|
||||
ELSE
|
||||
ERROR 53 'File not found
|
||||
END IF
|
||||
END SUB
|
||||
Loading…
Add table
Add a link
Reference in a new issue