Binary file to C array(bin2c)
/********************************************************************************
* Binary file to C array(bin2c)
* 说明:
* 由于工作中需要将bmp文件数据转换成C数组,于是写了这个工具(bin2c),代码如你
* 所见,只有看上去不多的几行.
*
* 2015-4-20 周一 阴 深圳 南山 西丽平山村 曾剑锋
*******************************************************************************/
#include <stdio.h>
#include <string.h> int main ( int argc, char** argv )
{
int i = ;
char ch = '\0'; if ( != argc ) {
printf( "\n Usage: bin2c <file> \n\n" );
return -;
} FILE *binfile = fopen( argv[], "rb" ); // get file name for array's name
while ( '.' != argv[][i++] );
argv[][ i- ] = ; //get file data and change to const unsigned char array's data
i = ;
printf( "const unsigned char %s[] = { \n\t", argv[] );
while ( EOF != (ch = fgetc( binfile )) )
printf( "0x%02X%s\t", (unsigned char)ch , ( i++ % ) == ? "\n" : "" );
printf( "\n};\n" ); fclose( binfile );
}
Binary file to C array(bin2c)的更多相关文章
- ubuntu安装jdk遇到的问题:cannot execute binary file
安装完jdk,配置好环境变量出现如下状况: cannot execute binary file 问题原因: jdk的位数与ubuntu的系统位数不一致 jdk 64位 ubuntu 32位 然后通过 ...
- linux出现bash: ./java: cannot execute binary file 问题的解决办法
问题现象描述: 到orcal官网上下载了两个jdk: (1)jdk-7u9-linux-i586.tar.gz ------------>32位 (2)jdk-7u9-linux-x64.tar ...
- grep:Binary file (standard input) matches
grep "key" xxx.log时输出 Binary file xxx.log matches 百度了一下:grep觉得这是二进制文件.解决方式:grep -a. grep - ...
- java: cannot execute binary file
转自:http://jxwpx.blog.51cto.com/15242/222572 java: cannot execute binary file 如果遇到这个错,一般是操作系统位数出问题了. ...
- javac: cannot execute binary file
# java/jdk1.6.0_12/bin/javac-bash: java/jdk1.6.0_12/bin/javac: cannot execute binary file 后来检验,检查了 ...
- -bash: /tyrone/jdk/jdk1.8.0_91/bin/java: cannot execute binary file
问题描述:今天在linux环境下安装了一下JDK,安装成功后,打算输入java -version去测试一下,结果却出错了. 错误信息:-bash: /tyrone/jdk/jdk1.8.0_91/bi ...
- linux环境下运行程序格式错误的问题,bash: ./helloworld: cannot execute binary file: Exec format error
在编译完quecOpen的example helloworld之后,我运行此程序,结果报错,详情如下: ricks@ubuntu:~/share/project/ql-ol-sdk/ql-ol-ext ...
- centos7下安装nmon后,无法运行,提示 cannot execute binary file或/lib64/ld64.so.1不存在
在centos 7.1上安装nmon后,从管网(http://nmon.sourceforge.net/pmwiki.php?n=Site.Download)下载tar包解压后,两台机器一台提示 ca ...
- CentOS 报错cannot execute binary file
在安装软件过程中执行文件,报错cannot execute binary file 1.查看是否root用户登录,当前用户是否有可执行权限 2.ls -l 查看文件是否具有可执行权限 3.要使用对应的 ...
随机推荐
- Jmeter 中Cookie管理器的使用
Jmeter中有好几个地方可以管理Cookie,比如 Http Cookie Manager HTTP Header Manager jmeter.property文件中: #CookieManage ...
- ESXi时间同步
●建立NTP服务器 1,修改下面的注册表键把值设置为1.注册表键:HKEY_LOCAL_MACHINE\SYSTEM\ CurrentControlSet\services\W32Time\TimeP ...
- Freemarker生成HTML静态页面
这段时间的工作是做一个网址导航的项目,面向用户的就是一个首页,于是就想到了使用freemarker这个模板引擎来对首页静态化. 之前是用jsp实现,为了避免用户每次打开页面都查询一次数据库,所以使用了 ...
- C# WPF 利用NPOI读写Excel文件
https://blog.csdn.net/a312024054/article/details/70139172 [各种样式] https://www.cnblogs.com/xwgli/archi ...
- English trip -- VC(情景课)5 C It's on Main Street 在主街上
Grammar focus 语法点: on, 在...上 next to , 旁边,周围 aross from , 对面 between 在...之间 in front of 在…前面 ...
- python模块——socket (实现简单的C/S架构端通信操作CMD)
# 服务端代码#!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = "loki" import socket impo ...
- 20170709pptVBA递归删除LOGO图片与文字
Public Sub StartRecursionFolder() Dim Pre As Presentation Dim FolderPath As String Dim pp As String ...
- 『PyTorch』第九弹_前馈网络简化写法
『PyTorch』第四弹_通过LeNet初识pytorch神经网络_上 『PyTorch』第四弹_通过LeNet初识pytorch神经网络_下 在前面的例子中,基本上都是将每一层的输出直接作为下一层的 ...
- python-day17--生成器
1.本质:就是迭代器 2.生成器函数: def func(): a=1 b=2 yield a #要返回的第一个值 yield b #要返回的第二个值 ret = func() #拿到一个生成器pri ...
- CSS样式属性——背景
背景——包括背景颜色.背景图片,以及背景图片的控制 background-color:设置背景色(transparent表示透明的背景色) background-image:设置元素的背景图片 ba ...