BINSTRTOFILE()

From Lianjapedia
Jump to: navigation, search

Purpose

Function to write a string to a binary file

Syntax

BINSTRTOFILE(<expC1>, <expC2> [, <expL> | <expN2>])

See Also

BIN2I(), BIN2L(), BIN2W(), BINCLOSE(), BINCREATE(), BINFILETOSTR(), BINOPEN(), BINREAD(), BINSEEK(), BINWRITE(), FCLOSE(), FILETOSTR(), FOPEN(), I2BIN(), L2BIN(), STRTOFILE()

Description

The BINSTRTOFILE() function writes the specified string out to the specified file and returns the number of bytes written as a numeric.

Parameter Description
<expC1> String expression to be written to the file
<expC2> Name of the output file. This should include the path if not in the current directory. If it does not exist, it will be created.
<expL> If True (.T.), the string will be appended to the file's previous contents. If False (.F.), the string will overwrite the file's previous contents. The default is False.
<expN> Optional settings, see below.

The optional <expN> setting can be any of the following and used instead of <expL>:

Value Setting
0 The string will overwrite the file's previous contents.
1 The string will be appended to the file's previous contents.
2 The Unicode BOM "FF FE" will be written to the start of the file. The string will overwrite the file's previous contents.
4 The UTF-8 BOM "EF BB BF" will be written to the start of the file. The string will overwrite the file's previous contents.

Example

cbinstr = binfiletostr("test.pdf")
? binstrtofile(cbinstr,"test2.pdf")
     29424