Audiovox P965 Datový list Strana 70

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 280
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 69
API in C using winsock
67
// read iBytesToRead from the socket
iBytesRead = recv(fdSock, szTmpWord, iBytesToRead, 0);
// terminate szTmpWord
szTmpWord[iBytesRead] = 0;
// concatenate szTmpWord to szRetWord
strcat(szRetWord, szTmpWord);
// subtract the number of bytes we just read from iLen
iLen -= iBytesRead;
}
// deallocate szTmpWord
free(szTmpWord);
DEBUG ? printf("word = %s\n", szRetWord) : 0;
return szRetWord;
}
else
{
return NULL;
}
}
/********************************************************************
* Read a sentence from the socket
* A Sentence struct is returned
********************************************************************/
struct Sentence readSentence(int fdSock)
{
struct Sentence stReturnSentence;
char *szWord;
int i=0;
int iReturnLength=0;
DEBUG ? printf("readSentence\n") : 0;
initializeSentence(&stReturnSentence);
while (szWord = readWord(fdSock))
{
addWordToSentence(&stReturnSentence, szWord);
Zobrazit stránku 69
1 2 ... 65 66 67 68 69 70 71 72 73 74 75 ... 279 280

Komentáře k této Příručce

Žádné komentáře