Chapter 4 Software Development
4-5-4. Standard I/O Examples
This Section presents examples actually using this standard I/O.
For further details on the printf_c(), puts(), and gets() library functions used, refer to the RTL665S
(1)Using standard output and write()
Section
For further details on the printf_c() and puts() library functions used, refer to the RTL665S
Sample Program Using Standard Output
/* Read/Write sample program 1 */
/* Filename:rw_smpl1.c */
/* Copyright(C) 1999 TECHNOCOLLAGE,Inc. All right reserved. */
#include<stdio.h>
#include<stdlib.h>
#include<m66573.h>
void main(void)
{
int day;
char *d_name[] = {
"Sunday : Sunday",
"Monday : Monday",
"Tuesday : Tuesday",
"Wednesday : Wednesday",
"Thursday : Thursday",
"Friday : Friday",
"Saturday : Saturday"};
/* Initialize MSM66Q573 */
std_init_573();
S0BUF = 0x0A;
/* Main display loop */
for(day=0;day<7;day++)
{
puts(d_name[day]); /* Send string to standard output */
}
}
(2)Using standard input and read()
The following source codes is an example of a program that reads from standard input.
For further details on the printf_c() and gets() library functions used, refer to the RTL665S Run- Time Library Reference.
page