FWRITEB

Purpose:

Writes a series to a binary file.

Syntax:

FWRITEB("filename", filetype, byteswap, series)

"filename"

-

A string, the name of the destination file.

filetype

-

An integer, the binary format type of the data file described by either its name or integer code. Valid arguments are:

 

Name

Code

Data Type

Range

INT8

SBYTE

1

8-bit Signed Byte

-128 to +127

UINT8

UBYTE

BYTE

2

8-bit Unsigned Byte

0 to 255

INT16

SINT

3

16-bit (2-byte) Signed Integer

-32768 to +32767

UINT16

UINT

4

16-bit (2-byte) Unsigned Integer

0 to 65535

INT32

LONG

5

32-bit (4-byte) Signed Integer

-2,147,483,648 to +2,147,483,647

FLOAT

6

32-bit (4-byte) Floating Point

-1037 to +1038

DOUBLE

7

64-bit (8-byte) Floating Point

-10-307 to +10308

UINT32

ULONG

8

32-bit (4-byte) Unsigned Integer

0 to 4,294,967,295

INT64

9

64-bit (8-byte) Signed Integer

-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807

UINT64

10

64-bit (8-byte) Unsigned Integer

0 to 18,446,744,073,709,551,615

 

1000 + N

N-byte Signed Integer

-28N-1 to 28N-1-1

 

2000 + N

N-byte Unsigned Integer

0 to 28N-1

 

byteswap

-

Optional. An integer. Swap the order of the bytes to write:

0:

do not swap bytes (default)

1:

swap bytes

series

-

Optional. A series, the values to write. Defaults to the current Window.

Returns:

Nothing.

Example:

fopen("test.bin", "wb")

fwriteb("test.bin", sint, {1..5})

fclose("test.bin")

 

a = readb("test.bin", sint)

a == {1, 2, 3, 4, 5}

 

FWRITEB writes 5 signed integer values to the file. READB returns the values as a series in variable a.

Remarks:

File must be opened with FOPEN before using FWRITEB. FWRITEB operates like WRITEB once FOPEN is used to open the file.

 

Use "wb" to open the binary file in write mode.

See Also:

FCLOSE

FOPEN

FWRITEB

FWRITEA

WRITEB