Sprintf and Sscanf can not convert float type data

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sprintf and Sscanf can not convert float type data

1,063 Views
leo_liu2
Contributor III

Hi:

   i want to use sscanf to convert a string into float ,follow is my code:

uint8 tt[] = {"$GPRMC,094411.00"};
uint8 a;
float t;
a = sscanf(tt,"%*[^,],%lf",&t);

when i compile and debug in S32DS,i found that i can't convert the string into float,i check the value of t,it's equal to 0 instead of 94411.00,when i change the type of t into integer,it can work but only for the integer part of 94411,the same situation appear in sprintf,what should i do to solve this problem?

0 Kudos
Reply
0 Replies