char类型占一个字节,8位

int类型四个字节32位

(long类型的转换跟int类型相同)

#include <stdio.h>

])
{
    buffer[] = (char)tmp;
    buffer[] = ();
    buffer[] = ();
    buffer[] = ();

    ;
}

int main()
{
    unsigned int tmp = 0x18345679;
    ] = {};
    ;

    IntToChar(tmp, buffer);

    ; i < 4;i++)
    {
        printf("buffer[%d] = %02x\n",i, buffer[i]);
    }
    getchar();
    ;
}

所得结果:

int(long) 类型转换为char的更多相关文章

  1. c++ string类型转换为char *类型

    string 是c++标准库里面其中一个,封装了对字符串的操作 把string转换为char* 有3中方法: 1.data 如: string str="abc"; char *p ...

  2. c++中char类型字符串拼接以及int类型转换为char类型 && 创建文件夹

    如下所示: #include <iostream> #include <windows.h> #include <cstring> using namespace ...

  3. 将short类型转换为char类型

    void short2char(uint8_t *arr1, uint16_t *arr2, int len) { ; ; for (x; x < len; x++) { arr1[x++] = ...

  4. Arduino中数据类型转换 int转换为char 亲测好使,itoa()函数

    由于博主最近在做一个项目,需要采集不同传感器的数据,包括float型的HCHO,以及int型的PM2.5数据.但是最终向服务器上传的数据都得转换为char型才能发送,这是借鉴了一个github上面的实 ...

  5. golang 学习之路 string转换为其他类型 其他类型转换为string

    将其他值转换为string 一般常用fmt.Sprintf(格式,转换的值) // 使用fmt.Sprintf 转换所有的类型为string 使用 这是第一种 // 注意在sprintf使用中需要注意 ...

  6. 34 char类型转换为int类型

    #include<iostream> #include<cstdlib > using namespace std; int main() { char a=101; int ...

  7. C++中将string类型转换为int, float, double类型 主要通过以下几种方式:

      C++中将string类型转换为int, float, double类型 主要通过以下几种方式: # 方法一: 使用stringstream stringstream在int或float类型转换为 ...

  8. 无法将类型为“System.Decimal”的对象强制转换为类型“System.Char[]”。

    在用微软的SSIS操作ORACLE 数据源的时候碰到以下报错信息: [ADO NET Destination [13455]] 错误: 数据插入期间出现异常,从提供程序返回的消息为:无法将类型为&qu ...

  9. CString向char类型转化 ---“=”: 无法从“wchar_t *”转换为“char *

    此文从网上复制过来,原文出处已丢失,望见谅哈       VC 2005中,这个本来很简单的问题又稍微复杂了一点.    在工程里面,一个必不可少的步骤就是把CString转换为shar*字符串.通过 ...

随机推荐

  1. windows2016上如何通过攻击ETERNALBLUE获得meterpreter反弹

    windows2016上如何通过攻击ETERNALBLUE获得meterpreter反弹 译:by  backlion 0x00前言 当微软发布MS17-010漏洞的补丁时,该漏洞影响的范围是从Win ...

  2. oAuth2.0理解

    转自http://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html 理解OAuth 2.0 作者: 阮一峰 日期: 2014年5月12日 OAuth是一个关 ...

  3. matlab图像

    1.在网络上发现matlab能画出一些很有意思的图形(立体爱心) clc; const=0; x=-5:0.05:5;y=-5:0.05:5;z=-5:0.05:5; [x,y,z]=meshgrid ...

  4. jsp中文乱码终极解决方法

    转载http://blog.csdn.net/csh624366188/article/details/6657350 一 找出问题的根源    乱码可能出现的地方:1 jsp页面中          ...

  5. 服务器上 tomcat 配置了 tomcat-users 但是还是 403 的问题

    默认情况下,tomcat 限制了只能本机访问 如果我们想要修改这个设置: 编辑 webapps/manager/META-INF/context.xml <!--<Valve classN ...

  6. 7.Configurator API 详细介绍

    一.Configurator类介绍与API解释 1.Configurator类介绍 1)用于设置脚本动过的默认延时 2)功能 a.可调节两个模拟动作间的默认时间间隔 b.可调节输入文本的输入时间间隔 ...

  7. [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: YES)

    在配置了zabbix服务端后,发现:“zabbix server is running”的Value值是“no”, 用:netstat -atnlp|grep 10051 发现没有出现zabbix_s ...

  8. Ubuntu 14.04.3 window10双系统情遇到'Disconnected: You are now offline'问题

    笔电是win10系统,单独开除50G做了一个Ubuntu系统,安装的是14.04.03版本,安装成功后,发现wifi连接不上,选择wifi并输入密码后提示:“Disconnected: You are ...

  9. php 傻瓜式代码计算两个时间间隔

    $stamp = (strtotime($_POST['start'])-strtotime($_POST['end'])); $s = $stamp%60; //秒 $m_stamp= ($stam ...

  10. 安装配置hexo icarus主题配置

    安装部分配置hexo icarus主题配置 安装icarus 直接下载主题模块放到blog项目 ,blog项目根目录执行 git clone https://github.com/ppoffice/h ...