athebustop
28-06-2004, 15:59
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 ...
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 ...