参考:
起始符:101
中间分隔符:01010
终止符:101
char *num = "6903244981002";//注意:商品码数据不能随便,有规则,校验值不对扫不出,开头3位690是中国的国家代码
/*
校验值计算
C1 = N1+N3+N5+N7+N9+N11,即6+0+2+4+8+0 = 20
C2 = (N2+N4+N6+N8+N10+N12)*3,(9+3+4+9+1+0)*3 = 78
CC = C1+C2 = 98 取个位数,即是8
C = 10 - CC,10-8 = 2;//校验值是2
*/
测试工程见资源:barcode_test.7z-互联网文档类资源-CSDN下载