11问答网
所有问题
怎样把float转化为char
如题所述
举报该问题
推荐答案 2017-03-07
方法是把整数和小数分开处理,最后加上'\0'。我复制了一段代码,你做参考。 // 函数名:unsigned char Float2Char(float Value,char *array) // 描 述:将浮点数的各个位的数值转换成字符串,通过串口发送至上位机显示 // 参 数:float Value为
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://11.wendadaohang.com/zd/274M8P77qF2F2F4FP2.html
相似回答
c++中
如何将float转换成char
型
答:
用 sprintf(s,"%f",f); 这种方式即可
。例如,c++ 程序 (若去掉前3行头文件,就是 c 预言程序):include<iostream> using namespace std;include<string> include <stdio.h> int main(){ float f=123.456;char s[20];sprintf(s,"%f",f);printf("%s\n",s);return 0;} ...
大家正在搜
int怎么转化为float
c语言float转char
int型转化为float
char转float
char数组转float
float转成char
char int float
intfloatchar区别
int char float字节
相关问题
c语言里怎么把float转换为char型?
如何在C++中,讲float型数据转换成char数据
c++中如何将char型数据转换成int float dou...
请问C语言中的float变量值存入char数组,和从char...
c语言里怎么把float转换为char型
C语言中如何将char[]转换为float?
如何将float 型数据转换为unsigned char 型
char数组如何转换为float