|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Registered User
Iscritto dal: Jun 2004
Messaggi: 47
|
[C++] assegnamento condizionato stringhe
ciao a tutti,
premettendo che ACCESO, SPENTO, CCSTUD e UNKNWN sono definiti come interi (rispettivamente 1, 2, 3, -1) come posso assegnare il valore alla stringa sendbuf[32] tramite un istruzione case? così non mi funziona.. ---------------------------------------------------------------------------- ... char sendbuf[32]; rstout = detect_output(); switch (rstout) { case ACCESO: sendbuf[32] = "acceso"; break; case SPENTO: sendbuf[32] = "spento"; break; case CCSTUD: sendbuf[32] = "ccstud"; break; case UNKNWN: sendbuf[32] = "unknwn"; break; default: sendbuf[32] = "unknwn"; break; } bytesSent = send(m_socket, sendbuf, strlen(sendbuf), 0); ... --------------------------------------------------------------------------- PS: vengo da PHP ... |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
strcpy(sendbuf, "acceso");
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 08:19.



















