资源简介
C语言生成二维码的方法

代码片段和文件信息
/*
* qrencode - QR Code encoder
*
* Binary sequence class.
* Copyright (C) 2006-2011 Kentaro Fukuchi
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License or any later version.
*
* This library is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not write to the Free Software
* Foundation Inc. 51 Franklin St Fifth Floor Boston MA 02110-1301 USA
*/
#if HAVE_CONFIG_H
# include “config.h“
#endif
#include
#include
#include
#include “bitstream.h“
BitStream *BitStream_new(void)
{
BitStream *bstream;
bstream = (BitStream *)malloc(sizeof(BitStream));
if(bstream == NULL) return NULL;
bstream->length = 0;
bstream->data = NULL;
return bstream;
}
static int BitStream_allocate(BitStream *bstream int length)
{
unsigned char *data;
if(bstream == NULL) {
return -1;
}
data = (unsigned char *)malloc(length);
if(data == NULL) {
return -1;
}
if(bstream->data) {
free(bstream->data);
}
bstream->length = length;
bstream->data = data;
return 0;
}
static BitStream *BitStream_newFromNum(int bits unsigned int num)
{
unsigned int mask;
int i;
unsigned char *p;
BitStream *bstream;
bstream = BitStream_new();
if(bstream == NULL) return NULL;
if(BitStream_allocate(bstream bits)) {
BitStream_free(bstream);
return NULL;
}
p = bstream->data;
mask = 1 << (bits - 1);
for(i=0; i if(num & mask) {
*p = 1;
} else {
*p = 0;
}
p++;
mask = mask >> 1;
}
return bstream;
}
static BitStream *BitStream_newFromBytes(int size unsigned char *data)
{
unsigned char mask;
int i j;
unsigned char *p;
BitStream *bstream;
bstream = BitStream_new();
if(bstream == NULL) return NULL;
if(BitStream_allocate(bstream size * 8)) {
BitStream_free(bstream);
return NULL;
}
p = bstream->data;
for(i=0; i mask = 0x80;
for(j=0; j<8; j++) {
if(data[i] & mask) {
*p = 1;
} else {
*p = 0;
}
p++;
mask = mask >> 1;
}
}
return bstream;
}
int BitStream_append(BitStream *bstream BitStream *arg)
{
unsigned char *data;
if(arg == NULL) {
return -1;
}
if(arg->length == 0) {
return 0;
}
if(bstream->length == 0) {
if(BitStream_allocate(bstream arg->length)) {
return -1;
}
memcpy(bstream->data arg->data arg->length);
return 0;
}
data = (unsigned char *)malloc(bstream->length + arg->length);
if(data == NULL) {
return -1;
}
memcpy(data bstream->data bstream->length);
memcpy(data + bstream->length arg->data arg->length);
f
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-02-25 22:31 QRcode\
文件 4310 2014-07-24 20:17 QRcode\bitstream.c
文件 1432 2014-07-24 20:17 QRcode\bitstream.h
文件 7274 2015-08-10 13:32 QRcode\mask.c
文件 1560 2014-07-04 08:43 QRcode\mask.h
文件 4276 2015-08-10 13:32 QRcode\mmask.c
文件 1404 2014-07-04 08:43 QRcode\mmask.h
文件 7476 2015-08-20 11:46 QRcode\mqrspec.c
文件 4774 2014-07-04 08:43 QRcode\mqrspec.h
文件 21241 2015-08-22 09:54 QRcode\qrencode.c
文件 21602 2015-08-20 09:58 QRcode\qrencode.h
文件 40683 2015-08-20 11:53 QRcode\qrinput.c
文件 3811 2015-08-20 09:32 QRcode\qrinput.h
文件 16277 2015-08-21 09:46 QRcode\qrspec.c
文件 5832 2014-07-24 20:17 QRcode\qrspec.h
文件 59427 2015-08-21 17:25 QRcode\QR_Encode.c
文件 3508 2016-02-25 22:31 QRcode\QR_Encode.h
文件 9508 2015-08-11 12:18 QRcode\rscode.c
文件 1468 2014-07-24 20:17 QRcode\rscode.h
文件 8539 2015-08-20 11:08 QRcode\split.c
文件 1913 2014-07-24 20:17 QRcode\split.h
相关资源
- C++中头文件与源文件的作用详解
- C语言代码高亮html输出工具
- 猜数字游戏 c语言代码
- C语言课程设计
- 数字电位器C语言程序
- CCS FFT c语言算法
- 使用C语言编写的病房管理系统
- 通信过程中的RS编译码程序(c语言)
- 计算机二级C语言上机填空,改错,编
- 用回溯法解决八皇后问题C语言实现
- 简易教务管理系统c语言开发文档
- 操作系统课设 读写者问题 c语言实现
- 小波变换算法 c语言版
- C流程图生成器,用C语言代码 生成C语
- 3des加密算法C语言实现
- 简单的C语言点对点聊天程序
- 单片机c语言源程序(51定时器 八个按
- 个人日常财务管理系统(C语言)
- c语言电子商务系统
- 小甲鱼C语言课件 源代码
- 将图片转换为C语言数组的程序
- C语言实现的一个内存泄漏检测程序
- DES加密算法C语言实现
- LINUX下命令行界面的C语言细胞游戏
- 用单片机控制蜂鸣器播放旋律程序(
- 学校超市选址问题(数据结构C语言版
- 电子时钟 有C语言程序,PROTEUS仿真图
- 尚观培训linux许巍老师关于c语言的课
- 算符优先语法分析器(C语言编写)
- 基于C语言的密码锁程序
评论
共有 条评论