Skip to main content

IAR Embedded Workbench for RL78 5.20

__readFile

In this section:
Syntax
__readFile(fileHandle, valuePtr)
Parameters
fileHandle

A macro variable used as filehandle by the __openFile macro.

valuePtr

A pointer to a variable.

Return value

Result

Value

Successful

0

Unsuccessful

Non-zero error number

Table 38. __ readFile return values 


For use with

All C-SPY drivers.

Description

Reads a sequence of hexadecimal digits from the given file and converts them to an unsigned long which is assigned to the value parameter, which should be a pointer to a macro variable.

Only printable characters representing hexadecimal digits and white-space characters are accepted, no other characters are allowed.

Example
__var number;
if (__readFile(myFileHandle, &number) == 0)
{
  // Do something with number
}

In this example, if the file pointed to by myFileHandle contains the ASCII characters 1234 abcd 90ef, consecutive reads will assign the values 0x1234 0xabcd 0x90ef to the variable number.