Epson S5U1C17001C Manual page 403

Cmos 16-bit single chip microcomputer, c compiler package for s1c17 family
Hide thumbs Also See for S5U1C17001C:
Table of Contents

Advertisement

write function
Contents of write function
Format:
int write(int fd, char *buf, int nbytes);
Argument:
int fd;
char *buf;
int nbytes; Number of transferred bytes
Functionality:
The data stored in the buffer indicated by buf is written as much as indicated by nbytes
to the user-defined output buffer.
Returned value: Number of bytes actually written to the output buffer
If data is written normally, nbytes is returned.
If a write error occurs, a value other than nbytes is returned.
Library function that calls the write function:
Direct call: fwrite, putc, _doprint (_doprint is printf-series internal function)
Indirect call: fputc, fputs, putchar, puts (calls putcc)
Definition of output buffer
Format:
unsigned char WRITE_BUF[65];
(Variable name is arbitrary; size is fixed to 65 bytes)
Buffer content: The size of the output data (1 to max. 64) is stored at the beginning of the buffer
(WRITE_BUF[0]). 0 denotes EOF.
The output data is stored in WRITE_BUF[1], and the following locations.
Precautions on using simulated i/O
When using the debugger's simulated I/O, define in the write function the global label WRITE_FLASH
that is required for the debugger to update the output buffer, and create a function so that data will be output
from the output buffer at that position. (For details about the simulated I/O function, refer to the chapter
where the debugger is discussed.)
A write function has been defined in the libstdio.a library. To use the read function, link
libstdio.a and call the _init_sys() function from the boot routine in the user program.
_exit function
Contents of _exit function
Format:
void _exit(void);
Functionality:
Performs program terminating processing.
Argument:
None
Returned value: None
Library function that calls the _exit function:
Direct call: abort, exit
S5U1C17001C ManUal
(C COMPilEr PaCkagE fOr S1C17 faMily) (Ver. 1.5.0)
File descriptor denoting output
When called from a library function, 1 (stdout) or 2 (stderr) is passed.
Pointer to the buffer that stores output data
printf, fprintf, sprintf, vprintf, vfprintf (calls _doprint)
perror (calls fprintf)
EPSOn
7 liBrary
7
Library
7-17

Advertisement

Table of Contents
loading

Table of Contents