Audiovox P965 Datenblatt Seite 240

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 280
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 239
API in C
237
// convert port string to an int
iPort = atoi(szPort);
}
iInteractiveMode ? printf("Connecting to API: %s:%d\n", szIPaddr, iPort) : 0;
fdSock = apiConnect(szIPaddr, iPort);
iLoginResult = login(fdSock, szUsername, szPassword);
if (!iLoginResult)
{
apiDisconnect(fdSock);
iInteractiveMode ? printf("Invalid username or password.\n") : 0;
exit(1);
}
// initialize first sentence
initializeSentence(&stSentence);
// main loop
while (1)
{
// get input from stdin
iInteractiveMode ? fputs("<<< ", stdout): 0;
iInteractiveMode ? fflush(stdout): 0;
if (fgets(cWordInput, sizeof cWordInput, stdin) != NULL)
{
szNewline = strchr(cWordInput, '\n');
if (szNewline != NULL)
{
*szNewline = '\0';
}
}
// check to see if we want to quit
if (strcmp(cWordInput, "quit") == 0)
{
break;
}
// check for end of sentence (\n)
else if (strcmp(cWordInput, "") == 0)
{
// write sentence to the API
if (stSentence.iLength > 0)
Seitenansicht 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 279 280

Kommentare zu diesen Handbüchern

Keine Kommentare