⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.c

📁 This little Program allows you to send commands to the CardReader (CT-BCS) or to the Card itself. F
💻 C
字号:
#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include "ctapi.h"void main (void){   unsigned char dad;   unsigned char sad;   unsigned short lenc;   unsigned short lenr;   char ende[10] = "y";   unsigned short pn;   unsigned short ctn = 10;   unsigned char dummy[100];   unsigned char command[300];   unsigned char response[300];   int i;   int retval;      scanf("%d", &pn);   retval = CT_init(ctn, pn);   printf("CT_init = %d\n", retval);      do {      sad = HOST;      printf("\nPlease enter the Destination of the APDU\n");      printf("1=CT or 0=ICC: ");      scanf("%d", &dad);      lenr = 300;      printf("CLA: ");      scanf("%2x", &command[0]);       printf("INS: ");      scanf("%2x", &command[1]);      printf("P1:  ");      scanf("%2x", &command[2]);      printf("P2:  ");      scanf("%2x", &command[3]);      printf("P3:  ");      scanf("%s", dummy);      lenc = 4;      if (strlen(dummy) > 0) {         command[4] = strtol(dummy, NULL, 16);         lenc++;         for (i=0; i<command[4]; i++) {            printf("DATA[%d]: ", i);            scanf("%2x", &command[lenc]);            lenc++;         }      }      retval = CT_data(ctn, &dad, &sad, lenc, command, &lenr, response);      printf("CT_data = %d\n", retval);      printf("sad = %d\t\tdad = %d\n", sad, dad);      printf("Contens of response\n");      xdata(response, lenr);      printf("\n\nSend an other Command (y/n)? ");      scanf("%s", &ende);   } while (!strncmp (ende, "y", 1));   CT_close(ctn);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -