BINFILE   [VDS6]

Top  Previous  Next

Syntax:

 

BINFILE OPEN,<file id>,<filename>,READ|WRITE|CREATE|APPEND

BINFILE CLOSE,<file id>

BINFILE SEEK,<file id>,<position>

BINFILE WRITE,<file id>,TEXT|BINARY|HEX,<data string>

BINFILE SAVERES, <resource type>, <resource id>, <filename>

 

Description:

 

[VDS6] This command has been superseded by new file input and output functions.

The purpose of the BINFILE command is to allow binary disk files to be read and written.

BINFILE OPEN opens a file in memory in three different possible modes.

BINFILE CLOSE closes the specified file.

BINFILE SEEK sets the position into the specified file.

BINFILE WRITE writes to the specified file in the specified format.

The <file id> may be a number in the range 1 to 4.

When BINFILE WRITE is used, the data format must be specified. It may be one of:
 

TEXT (default): data must consist solely of printable characters.
BINARY: each byte value is represented by a number of value 0..255. Each value is separated by the separator character specified in OPTION FIELDSEP.
HEX: each byte value is represented by a two digit hex number. Each number is separated by a single space.

BINFILE SAVERES command allows a user defined resource that has been linked in to the executable file to be saved to disk using the specified filename and path.  Note that the <resource type> should be a user defined resource type name such as BINARY, which was used in the #RESOURCE directive that specified the file to be linked. Windows-supported resource types such as ICON and BITMAP are stored using ordinal type names.  If the <resource type> is specified as (for example) "BITMAP" then the resource will not be found, as there is no actual type with this name.

It is possible to access Windows-supported resources using the ordinal number, if you know it. However, most Windows-supported resource types are stored in a special resource format which is not the same as the format used on disk. If a resource such as a bitmap or icon is saved to disk using the BINFILE SAVERES command it will not be readable by a bitmap or icon editor. Therefore, it is important that user-defined types are used when linking resources intended to be used with this command, to ensure that they are linked as raw binary data.

 

OK:

 

Set to false if the named file does not exist.

 

Example:

 

BINFILE OPEN,1,C:\AUTOEXEC.BAT,READ

 

See also:

 

@BINFILE