[C.C++] C语言生成二维码

268 0
Honkers 2025-5-23 12:57:52 来自手机 | 显示全部楼层 |阅读模式

1. 效果

2. 需要的代码(QRCode)

  • qrcode.c
  • qrcode.h
    代码

3. 代码

  1. #include <stdio.h>
  2. #include "qrcode.h"
  3. int main()
  4. {
  5. //拓展编码
  6. SetConsoleOutputCP(437);
  7. QRCode qrcode;
  8. uint8_t qrcodeBytes[qrcode_getBufferSize(3)];
  9. qrcode_initText(&qrcode, qrcodeBytes, 3, ECC_LOW, "Hello World!");
  10. for (uint8_t y = 0; y < qrcode.size; y++)
  11. {
  12. for (uint8_t x = 0; x < qrcode.size; x++)
  13. {
  14. if(qrcode_getModule(&qrcode, x, y))
  15. {
  16. printf("%c%c",219,219);
  17. }
  18. else
  19. {
  20. printf(" ");
  21. }
  22. }
  23. printf("\n");
  24. }
  25. while(1);
  26. }
复制代码

4. 方块打印方法

C语言输出ASCII 219无法显示方格

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Honkers

荣誉红客

关注
  • 4013
    主题
  • 36
    粉丝
  • 0
    关注
这家伙很懒,什么都没留下!

中国红客联盟公众号

联系站长QQ:5520533

admin@chnhonker.com
Copyright © 2001-2025 Discuz Team. Powered by Discuz! X3.5 ( 粤ICP备13060014号 )|天天打卡 本站已运行