SourcePoint AMD Help

Table of Contents

fwrite

Write binary data from an array into a file.

Syntax

[result =] fwrite(buffer, file_handle)

Where:

result

specifies a debug variable of type ord4 to which the function return value is assigned. If result is not specified, the return value is displayed on the next line of the screen.

buffer

is an array variable containing the data to write.

file_handle

is a file handle returned from a previous fopen command.

Discussion

The fwrite function writes binary data to a file previously opened by an fopen command. The data is stored in the array. ย The returned value is true if successful.

Example

To write 512 bytes of memory at location 0 to a binary file:

Command input:

define ord4 i
define ord4 file1
define ord1 Buf[0x200]
define ord4 MEM_BUFFER = 0

ย 

file1 = fopen("test.dat", "wb")

for (i=0 ; i < 0x200; i++)

ย ย ย Buf[i] = ord1(MEM_BUFFER + i)

fwrite(Buf, file1)

fclose(file1)

Related Topics: