代码拉取完成,页面将自动刷新
#include "devices.h"
#include "idcard/idcard.h"
#include <fstream>
using namespace std;
int main()
{
char buf[512];
const char *info = idcard::getInfo();
printf("%s\n", info);
idcard::init();
int n = idcard::getIDCardData(0, buf, 512);
if (0 != n)
printf ("Error: %d\n", n);
else
printf("%s\n", buf);
idcard::getIDCardData(1, buf, 64);
printf("姓名: %s\n", buf);
idcard::getIDCardData(2, buf, 16);
printf("性别: %s\n", buf);
idcard::getIDCardData(3, buf, 128);
printf("民族: %s\n", buf);
idcard::getIDCardData(4, buf, 16);
printf("出生年: %s\n", buf);
idcard::getIDCardData(5, buf, 16);
printf("出生月: %s\n", buf);
idcard::getIDCardData(6, buf, 16);
printf("出生日: %s\n", buf);
idcard::getIDCardData(7, buf, 256);
printf("住址: %s\n", buf);
idcard::getIDCardData(8, buf, 64);
printf("公民身份号码: %s\n", buf);
idcard::getIDCardData(9, buf, 256);
printf("签发机关: %s\n", buf);
idcard::getIDCardData(10, buf, 16);
printf("起始年: %s\n", buf);
idcard::getIDCardData(11, buf, 16);
printf("起始月: %s\n", buf);
idcard::getIDCardData(12, buf, 16);
printf("起始日: %s\n", buf);
idcard::getIDCardData(13, buf, 16);
printf("截止年: %s\n", buf);
idcard::getIDCardData(14, buf, 16);
printf("截止月: %s\n", buf);
idcard::getIDCardData(15, buf, 16);
printf("截止日: %s\n", buf);
idcard::getIDCardData(16, buf, 64);
printf("芯片序列号: %s\n", buf);
const char *fpath = "/tmp/id.bmp.b64";
char *buff = nullptr;
int len = 0;
n = idcard::getIDCardImages(1, &buff, len);
ofstream out(fpath, ios::out);
if (out.is_open()) {
out << buff << endl;
out.close();
}
delete [] buff;
printf("base64 data in file %s , lenngth: %d\n", fpath, len);
return 0;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。