
API in C
238
{
writeSentence(fdSock, &stSentence);
// receive and print response block from the API
stBlock = readBlock(fdSock);
printBlock(&stBlock);
// clear the sentence
clearSentence(&stSentence);
}
}
// if nothing else, simply add the word to the sentence
else
{
addWordToSentence(&stSentence, cWordInput);
}
}
apiDisconnect(fdSock);
exit(0);
}
Notes
•• The code has been tested with up to 3-byte encoded length. 4 and 5 byte encoded length have not been tested yet.
The logic for 4-byte length should work, and 5-byte lengths are too long for standard-sized int in C.
•• The code has been tested successfully with little endian (PC) and big endian (MIPSBE) processors.
Komentáře k této Příručce