代码样本
A R PHONE
A CF03(03 'EXIT')
A 1 35'PHONE BOOK'
A DSPATR(HI)
A 7 28'Name:'
A NAME 11A I 7 34
A 9 25'Address:'
A ADDRESS 20A I 9 34
A 11 25'Phone #:'
A PHONE_NUM 8A I 11 34
A 23 34'F3 - EXIT'
A DSPATR(HI)
/* This program uses a response indicator to inform the program */
/* that F3 was pressed by a user. The response indicator is returned */
/* in part of the file buffer. */
#include <stdio.h>
#include <recio.h>
#include <stdlib.h>
typedef struct{
char in03;
char name[11];
char address[20];
char phone_num[8];
}info;
#define IND_ON '1'
int main(void)
{
_RFILE *fp;
_RIOFB_T *rfb;
info phone_list;
if (( fp = _Ropen ( "*LIBL/T1520DD9", "ar+" )) == NULL )
{
printf ( "display file open failed\n" );
exit ( 1 );
}
_Rformat ( fp, "PHONE" );
rfb = _Rwrite ( fp, "", 0);
rfb = _Rreadn ( fp, &phone_list, sizeof(phone_list), __DFT );
if ( phone_list.in03 == IND_ON )
{
printf ( "user pressed F3\n" );
}
_Rclose ( fp );
}
注: 此程序使用响应指示符
IND_ON "1" 来通知 ILE C 程序 T1520ID1 用户按了 F3。