Hi,
I want to use Windows Hyperterminal to send a text file to the palm and to
display the text on the palm. This is for testing purposes.
The Text file is like follows:
16534567
16534567
16534567
16534567
16534567
I send the file and what I get display on the Palm is the number of bytes in
the buffer. This is correct, but I want to display each character received.
What I get is the following:
1^{[]6, etc...
What I want to see is what is in the text file above.
16534567
16534567
16534567
16534567
Any suggestions?
Thanks,
Darrin
Here is the ReceiveTerminal code:
void ReceiveTerminal (void)
{
char szBuf[1024];
static int index = 0;
Err error;
ULong ulBytes;
int increment1, i;
CharPtr sA, sX, cStatus, sBytes, sBuffer;
long timeout;
increment = 0;
increment1 = 0;
if (Connected == 0) return;
timeout = SysTicksPerSecond() / 2;
error = SerReceiveWait(gSerialRefNum, sizeof(szBuf) - 1, timeout);
if (error == serErrLineErr)
{
FrmAlert(RS232LineErrorAlert);
SerReceiveFlush(gSerialRefNum,100);
index = 0;
return;
}
if (error == serErrTimeOut)
{
FrmAlert(InterbyteTimeoutAlert);
SerReceiveFlush(gSerialRefNum,100);
index = 0;
return;
}
error = SerReceiveCheck(gSerialRefNum, &ulBytes);
// display number of bytes in buffer to screen
StrIToA(sBytes, (int)ulBytes);
sBuffer = "Buffer";
WinDrawChars(sBuffer, StrLen(sBuffer), 30,146);
WinDrawChars(sBytes, StrLen(sBytes), 60, 146);
if (error == serErrLineErr)
{
FrmAlert(RS232LineErrorAlert);
SerReceiveFlush(gSerialRefNum,100);
index = 0;
return;
}
if (error == serErrTimeOut)
{
FrmAlert(InterbyteTimeoutAlert);
SerReceiveFlush(gSerialRefNum,100);
index = 0;
return;
}
do
{
SerReceive(gSerialRefNum,&szBuf[index] - 1,1,0,&error);
if (error == serErrLineErr)
{
FrmAlert(RS232LineErrorAlert);
SerReceiveFlush(gSerialRefNum,100);
index = 0;
return;
}
if (error == serErrTimeOut)
{
FrmAlert(InterbyteTimeoutAlert);
SerReceiveFlush(gSerialRefNum,100);
index = 0;
return;
}
sX = &szBuf[index];
//Draw chars until screen line full, then move down a line
//Draw 8 lines before overwritting first line
WinDrawChars(sX, StrLen(sX), 5 + increment1, 70 + increment);
increment1 = increment1 + 10;
if (increment1>130)
{
increment1 = 0;
increment = increment + 10;
}
if (increment>60)
{
increment = 0;
}
index++;
ulBytes--;
} while (ulBytes);
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/