SourcePoint AMD Help

Table of Contents

feof

Test for end of file (EOF).

Syntax

[result =] feof(file_handle)

Where:

result

specifies an debug variable of type int4 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.

file_handle

is returned from a previous fopen command.

Discussion

The feof function is used to test for the end of file condition. If a file input function has attempted to read past the end of a file, calling the feof function returns a value of 00000010H; otherwise, a null value is returned.

Example

To read a binary file and write its contents into target memory at address 0:

Command input:

define ord4 file1
define ord4 nItemsRead
define ord4 buf[1000]
define ptr pMem = 0

ย 

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

while (feof(file1) == 0)

{

ย ย ย nItemsRead = fread(buf, file1)

ย ย ย ord1 pMem length nItemsRead = buf

ย ย ย pMem += nItemsRead

}

fclose(file1)

Related Topics: