@BLOAD — Loads data from a file
into a binary buffer.
Syntax:
%@BLOAD[filename]
| filename | the file to load into a binary buffer |
This function allocates a new binary buffer of the same size as the file,
loads the named file into it, and returns the handle of the new buffer.
The number of bytes loaded — i.e. the file size —
is available through _BLOADSIZE.
If any error occurs while allocating the buffer or reading the file,
@BLOAD returns 0; the Windows error code is in
_BBLASTERR.
The maximum file size that @BLOAD will load is eight megabytes
in x86 TCC, or one gigabyte in x64 TCC.
(You could of course do the same thing with @FILESIZE,
@BALLOC, @FILEOPEN, @BREAD, and
@FILECLOSE. This function just spares you the tedium.)
rem Load a file into a buffer and display it:
set bbuf=%@bload[build.txt]
bbdump %bbuf
set rv=%@bfree[%bbuf]
See also: @BSAVE.