社区
C语言
帖子详情
近日开始学做条码应用,请问C/C++中有无memset函数,用法?作用?(100)
initora
2002-03-27 04:53:36
同上
...全文
23
5
打赏
收藏
近日开始学做条码应用,请问C/C++中有无memset函数,用法?作用?(100)
同上
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
initora
2002-03-27
打赏
举报
回复
谢谢,结帐!
prototype
2002-03-27
打赏
举报
回复
change 'memory.h' to 'string.h'. the latter is a standard library.
coraykuang
2002-03-27
打赏
举报
回复
Sets buffers to a specified character.
void *memset( void *dest, int c, size_t count );
Return Value
memset returns the value of dest.
Parameters
dest
Pointer to destination
c
Character to set
count
Number of characters
Remarks
The memset function sets the first count bytes of dest to the character c.
Example
/* MEMSET.C: This program uses memset to
* set the first four bytes of buffer to "*".
*/
#include <memory.h>
#include <stdio.h>
void main( void )
{
char buffer[] = "This is a test of the memset function";
printf( "Before: %s\n", buffer );
memset( buffer, '*', 4 );
printf( "After: %s\n", buffer );
}
Output
Before: This is a test of the memset function
After: **** is a test of the memset function
cococut
2002-03-27
打赏
举报
回复
#include <memory.h>
#include <stdio.h>
void main( void )
{
char buffer[] = "This is a test of the memset function";
printf( "Before: %s\n", buffer );
memset( buffer, '*', 4 );
printf( "After: %s\n", buffer );
}
Output
Before: This is a test of the memset function
After: **** is a test of the memset function
coraykuang
2002-03-27
打赏
举报
回复
Sets buffers to a specified character.
void *memset( void *dest, int c, size_t count );
Return Value
memset returns the value of dest.
Parameters
dest
Pointer to destination
c
Character to set
count
Number of characters
Remarks
The memset function sets the first count bytes of dest to the character c.
Example
/* MEMSET.C: This program uses memset to
* set the first four bytes of buffer to "*".
*/
#include <memory.h>
#include <stdio.h>
void main( void )
{
char buffer[] = "This is a test of the memset function";
printf( "Before: %s\n", buffer );
memset( buffer, '*', 4 );
printf( "After: %s\n", buffer );
}
Output
Before: This is a test of the memset function
After: **** is a test of the memset function
OpenCV + zbar开源库实现摄像头识别二维码
OpenCV+zbar开源库实现摄像头识别二维码,测试验证识别率非常高,已实现简单的
应用
。 打包源码在VS2013下可以完全编译成功,附加包含OpenCV库及zbar-0.10-setup.exe,zbar-0.10.tar.bz2 下载Demo后需要安装 zbar-0.10-setup.exe 以下代码可以可以完成整个流程的开发,也可以贡献积分下载资源包。 1、 环境准备 (1) OpenCV库2.49 (2) ZBar开源库 (3) VS2013 2、 VS2013环境配置 (1) 配置附加包含目录 C/
C++
-- 附加包含目录 include\opencv\include\ include\opencv\include\opencv include\opencv\include\opencv2 include (2) 配置链接器 链接器 -- 附加库目录 lib32\opencv\lib lib32 (3) 配置链接器 链接器--输入--附加依赖项 opencv_core249d.lib opencv_highgui249d.lib opencv_imgproc249d.lib libzbar-0.lib 3、 代码开发 (1)包含头文件 include include include include include include using namespace std; using namespace zbar; using namespace cv; (2)实现
函数
void MatToCImage(cv::Mat &mat, CImage &cImage) { //create new CImage int width = mat.cols; int height = mat.rows; int channels = mat.channels(); cImage.Destroy(); //clear cImage.Create(width, height, 8 * channels); //默认图像像素单通道占用1个字节 //copy values uchar* ps; uchar* pimg = (uchar*)cImage.GetBits(); //A pointer to the bitmap buffer int step = cImage.GetPitch(); for (int i = 0; i (i)); for (int j = 0; j GetDlgItem(IDC_STATIC_IMG)->GetClientRect(▭); cv::VideoCapture capture(0);//从摄像头读入图像 while (!m_bCloseCamera) { cv::Mat frame; capture >> frame; cv::Mat newframe; cv::Size ResImgSiz = cv::Size(rect.Width(), rect.Height()); cv::resize(frame, newframe, ResImgSiz, CV_INTER_CUBIC); MatToCImage(newframe, imgDst); imgDst.Draw(pThis->GetDlgItem(IDC_STATIC_IMG)->GetDC()->GetSafeHdc(), rect); ImageScanner scanner; scanner.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1); Mat imageGray; cvtColor(frame, imageGray, CV_RGB2GRAY); int width = imageGray.cols; int height = imageGray.rows; uchar *raw = (uchar *)imageGray.data; Image imageZbar(width, height, "Y800", raw, width * height); scanner.scan(imageZbar); //扫描
条码
Image::SymbolIterator symbol = imageZbar.symbol_begin(); if (imageZbar.symbol_begin() == imageZbar.symbol_end()) { } else { iIndex++; if (iIndex > 999999) { iIndex = 0; } for (; symbol != imageZbar.symbol_end(); ++symbol) { char szInfo[1024];
memset
(szInfo, 0, sizeof(szInfo)); sprintf(szInfo, "[d]类型:%s\r\n
条码
:%s\r\n", iIndex , symbol->get_type_name().c_str(), symbol->get_data().c_str()); pThis->GetDlgItem(IDC_EDIT1)->SetWindowText(szInfo); } } imageZbar.set_data(NULL, 0); } imgDst.Destroy(); capture.release(); return 0; }
使用
C++
生成条形码
一、条形码介绍 条形码(barcode)是将宽度不等的多个黑条和空白,按照一定的编码规则排列,用以表达一组信息的图形标识符。常见的条形码是由反射率相差很大的黑条(简称条)和白条(简称空)排成的平行线图案。
条码
种类很多,常见的大概有二十多种码制,其
中
包括: Code39码(标准39码)、Codabar码(库德巴码)、Code25码(标准25码)、ITF25码(交叉25码)、Matrix25码(矩阵...
嵌入式c/
c++
打印机标准指令TSPL指令书写
【代码】嵌入式c/
c++
打印机标准指令TSPL指令书写。
c++
常用
函数
所在头文件一览
c++
常用
函数
所在头文件一览
C++
生成条型码和二维码源码及调用示例 还是C#方便
先画条型码会影响二维码,生成的没问题,粘到主图有问题,改成::SetStretchBltMode(memDC, COLORONCOLOR);后正常,不论先后顺序。先画二维码正常,正常情况下也不重叠。
C++
处理二维码: 字符串--二维码比特矩阵--保存二维码图片--粘到主图
中
。先看调用,越简单越好。
C语言
69,371
社区成员
243,080
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章