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

📄 simpletest.c

📁 Datamatrix二维码库和测试程序,运行于linux,仔细研究可以很容易转化成VC程序,有这就没必要化钱买个控件了,本人libdmtx-0.3版本转化过,的确可行,现在把找到该版本的libdmtx
💻 C
字号:
/*libdmtx - Data Matrix Encoding/Decoding LibraryCopyright (c) 2007 Mike LaughtonThis library is free software; you can redistribute it and/ormodify it under the terms of the GNU Lesser General PublicLicense as published by the Free Software Foundation; eitherversion 2.1 of the License, or (at your option) any later version.This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNULesser General Public License for more details.You should have received a copy of the GNU Lesser General PublicLicense along with this library; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USAContact: mike@dragonflylogic.com*//* $Id: simpletest.c 501 2008-11-07 16:49:28Z mblaughton $ */#include <stdlib.h>#include <stdio.h>#include <string.h>#include <dmtx.h>intmain(int argc, char *argv[]){   unsigned char str[] = "30Q324343430794<OQQ";   DmtxEncode    enc;   DmtxImage    *img;   DmtxDecode    dec;   DmtxRegion    reg;   DmtxMessage  *msg;   fprintf(stdout, "input:  \"%s\"\n", str);   /* 1) ENCODE a new Data Matrix barcode image (in memory only) */   enc = dmtxEncodeStructInit();   dmtxEncodeDataMatrix(&enc, strlen(str), str, DmtxSymbolSquareAuto);   /* 2) COPY the new image data before freeing encoding memory */   img = dmtxImageMalloc(enc.image->width, enc.image->height);   memcpy(img->pxl, enc.image->pxl, img->width * img->height * sizeof(DmtxRgb));   dmtxEncodeStructDeInit(&enc);   /* 3) DECODE the Data Matrix barcode from the copied image */   dec = dmtxDecodeStructInit(img);   reg = dmtxDecodeFindNextRegion(&dec, NULL);   if(reg.found != DMTX_REGION_FOUND)      exit(0);   msg = dmtxDecodeMatrixRegion(img, &reg, -1);   if(msg != NULL) {      fputs("output: \"", stdout);      fwrite(msg->output, sizeof(unsigned char), msg->outputIdx, stdout);      fputs("\"\n\n", stdout);      dmtxMessageFree(&msg);   }   dmtxDecodeStructDeInit(&dec);   dmtxImageFree(&img);   exit(0);}

⌨️ 快捷键说明

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