📄 s2l8.c
字号:
/*********************************************************************
* S2L8.c - (Section 2, Lesson 8) SEEKING THROUGH MESSAGES
* This is the RTDX Target Code for Section 2, Lesson 8
********************************************************************/
#include <rtdx.h> /* defines RTDX target API calls */
#include "target.h" /* defines TARGET_INITIALIZE() */
#include <stdio.h> /* C_I/O */
/* These are the values we are going to send to the host */
#define VALUES_TO_SEND {1,2,3,4,5,6,7,8,9,10}
/* declare an output channel */
RTDX_CreateOutputChannel( ochan );
void main()
{
int arraydata[] = VALUES_TO_SEND;
int i, status;
TARGET_INITIALIZE();
/* enable the output channel */
RTDX_enableOutput( &ochan );
for (i = 0; i < sizeof(arraydata)/sizeof(arraydata[0]); i++) {
/* send an array of integers to the host */
status = RTDX_write( &ochan,
&arraydata[i],
sizeof(arraydata[i]));
if ( status == 0 ) {
puts( "ERROR: RTDX_write failed!\n" );
exit( -1 );
}
while ( RTDX_writing != NULL ) {
#if RTDX_POLLING_IMPLEMENTATION
RTDX_Poll();
#endif
}
}
/* disable the output channel */
RTDX_disableOutput( &ochan );
puts( "Program Complete!\n" );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -