Code:NextBasic Snippets: Difference between revisions
From SpecNext Wiki
No edit summary |
No edit summary |
||
| Line 16: | Line 16: | ||
fsize=%a | fsize=%a | ||
CLOSE #4 | CLOSE #4 | ||
</syntaxhighlight> | |||
Check if a file exists in a location without generating an error | |||
<syntaxhighlight> | |||
Layer 2,0: print at 0,0; : cat file$: exist$=screen$(0,0) | |||
Layer 0: If exist$<>"N" then print "File found" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 13:12, 11 December 2023
NextBasic Snippets
To read a file of any type or size to any bank this will load myfile.bin to bank 22 (8kbs):
.extract myfile.bin -mb 22To get the filesize of a file in to var fsize:
OPEN #4, "myfile"
DIM #4 TO %a
fsize=%a
CLOSE #4Check if a file exists in a location without generating an error
Layer 2,0: print at 0,0; : cat file$: exist$=screen$(0,0)
Layer 0: If exist$<>"N" then print "File found"