完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好,我有一个问题,其中ATOF总是给出值零点,我包括LabaRy[Ai] & lt;Stdio.H≫和γ包含& lt:STDLI.H.G.;但是它仍然给出零。但是timeIh字符串的值为零!我错过了什么????!
以上来自于百度翻译 以下为原文 Hello, I have a problem where the atof is giving the value zero always, I have include the libary #include #include //test is a string //test="20170519103232.000,,,,0.00,0.0,0,,,,,,2,0,,,26,,"; float time =atof(test); sprintf(time_string, "%fn", time ); But the value of the time_string is zero! What I'm missing : ?!?! |
|
相关推荐
13个回答
|
|
我记得读过其他帖子,说如果错误的数学库被收录,ATOF可能会失败。
以上来自于百度翻译 以下为原文 I recall reading other posts saying atof can fail if the wrong math library is being included. |
|
|
|
代码很大,但我会把这里的重要部分,我用XC32编译器:即使值是大的,2017051913156000我甚至要求下一个89.026992,得到相同的结果。 以上来自于百度翻译 以下为原文 The code its big , but I will put here the important parts, I'm using the xc32 compiler: even if the value is to big , the 20170519131506.000 I even ask for the next one the 89.026992, got the same result #include #include #include #include "mcc_generated_files/mcc.h" #include #include int get_coor() { uint8_t coor_data[500] uint8_t txData[200]; uint8_t rxData[200]; int rx_size = 0; double latitude = 0; double longitude = 0; int speed = 0; int satellites = 0; int quality = 0; double altitude = 0; double time=0; txData[0] = ' |