03 2014 档案
摘要:求浮点数转换成字符串,如何才能获得比较正确的字符串。用printf("%f\n", (float)5); 这种方式转换出来的结果是 5.000000 ,末尾都会带6位小数。控制精度在6位,虽然控制精度在6位,但并不希望输出时后面出现多余0。需要: 精度控制 6 位,剔除多余占位零。printf和gcvt这两个函数多有些不太满足要求。实际想得到的结果float string---------------------------------5 "5.0"5.1 "5.1"5.001 "5.001"5.0000001 &
阅读全文
摘要:#include #include "LEDDisplay.h"#include "Temperature.h"#include "Pins.h"#define Delay_REF 12 //设置每一个点显示的时间长度(1~20)#define LED_PWDDEFAULT 9 // LED的调光值 1~9#define DT_P2M0SET 0x00 // 0000 0000#define DT_P2M1SET 0x00 // 0000 0000#define DT_P0M0SET 0xf0 ...
阅读全文
摘要:String能自动释放,在进行内存拷贝时需要进行手动释放。可以直接调用Finalize手工释放如:TGraphicHideTab 记录中声明的Caption:stringTGraphicHideTab = record Image:Integer; Data:Integer; Size:Integer; /// 绘制时使用的尺寸 Caption:string; /// = 0) and (AIndex < FCount) then begin Finalize(FItems[AIndex]); // <-- 手工释放Record中...
阅读全文

浙公网安备 33010602011771号