donner comme valeur un pointeur à un index de tableau
Bonsoir,
J'essaie de transformer cette fonction en C dans laquelle le tableau contenant la commande envoyé à une API a son dernier index pointant sur un pointeur, si je comprend bien la longueur ATR contenu dans cmd[4] est calculé à posteriori à partir de la réponse, mais je vois pas comment faire cela en vb.net
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| unsigned char cmd[5];
unsigned char rsp[252];
unsigned short rspLen;
/* Build command */
cmd[0] = 0x80;
cmd[1] = 0x36;
cmd[2] = 0x00;
cmd[3] = 0x00;
cmd[4] = *atrLength;
/* Send command */
rspLen = sizeof(rsp);
deviceLastError = sSmartISOEx( cscHandle, samSlot, 5, cmd, &rspLen, rsp );
*atrLength = (unsigned char)rspLen - 2; |
Le prototype de la fonction comme il est spécifié
Code:
1 2 3 4 5 6
| short sSmartISOEx (CSC_HANDLE apiHandle,
eDestReaderType xDestReaderType,
USHORT usInDataLen,
const UCHAR *pucDataIn,
USHORT *pusOutDataLen,
UCHAR *pucDataOut); |
Pour le moment ma commande qui fonctionne ressemble à ca:
Code:
1 2 3 4 5 6 7 8 9
| Dim command(4) As Byte
command(0) = 128
command(1) = 54
command(2) = 0
command(3) = 0
command(4) = 255 ' 255 pour prévoir le max possible de la réponse
Dim rsp(255) As Byte ' 255 pour prévoir le max possible de la réponse
'Dim rspLen As New uint16 = 255
ApiReturn = sSmartISOEx(cscHandle, samSlot,5,cmd(0), rspLen,rsp(0)) |
Merci par avance pour les pistes, car là je vois pas du tout comment faire.