Listing 2-1. Caesar_Cipher_ThreadType::Run() Implementation
2-10
Getting Started with ADSP-BF537 EZ-KIT Lite
Listing 2-1.
Caesar_Cipher_ThreadType::Run()
Implementation
void
Caesar_Cipher_ThreadType::Run()
{
static char *pszWelcome = "Welcome to Blackfin. Type letters
\"A\" though \"Z\" and I will encrypt them.\xa\xd";
if ( 0 >= send ( m_iSocket, pszWelcome, strlen ( pszWelcome ),
0 ) )
return;
while (1)
{
int iCount;
if ( ( iCount = recv ( m_iSocket, m_vInBuf, sizeof (
m_vInBuf ) / sizeof ( char ), 0 ) ) >= 1 )
{
int iCharNum;
char c;
for ( iCharNum = 0; iCharNum < iCount; ++iCharNum )
{
c = m_vInBuf [ iCharNum ];
if ( ( c >= 'A' && c <= 'Y' ) || ( c >= 'a' && c <=
'y' ) )
++c;
else if ( c == 'Z' || c == 'z' )
c -= ( 'Z' - 'A' );
m_vOutBuf [ iCharNum ] = '\x8'; /* telnet back-
space control character to overwrite the character sent */
m_vOutBuf [ iC iCount ] = c;
}
if ( send (m_iSocket, m_vOutBuf, iCount * 2, 0) <= 0 )
break;
}
www.BDTIC.com/ADI
Содержание EZ-KIT Lite ADSP-BF537
Страница 4: ...www BDTIC com ADI ...
Страница 8: ...CONTENTS viii Getting Started with ADSP BF537 EZ KIT Lite www BDTIC com ADI ...
Страница 52: ...Listing 1 3 Exercise 1 Part 3 1 30 Getting Started with ADSP BF537 EZ KIT Lite www BDTIC com ADI ...
Страница 88: ...What s Next 3 22 Getting Started with ADSP BF537 EZ KIT Lite www BDTIC com ADI ...