Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 5, 3 & 1 Forum Discussions

chmoc_1567941
Level 4
Level 4

hi,

   

I have been working on converting float value to hex value through different method.

   

like this:

   

int main() 
{

   

    char str[32];

   


    float a = 3.1415927;
 
    sprintf(str,"%X", *(int *)&a);
   

   

    return 0;
}

   

This is small part of my whole program. This is working perfect with C normal IDE software but when i add this program in creator.it gives error like this:

   

type error in argument 2 to `sprintf'; found `pointer to __flash char' expected `pointer to char'

   

can anyone explain me how can i overcome this error??

   

i need to convert float value to hex value for my program.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

For PSoC1 use csprintf() when the format is (as usual) a const string in flash.

   

Greetings from John von Neumann 😉

   

 

   

Bob

View solution in original post

0 Likes
1 Reply
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

For PSoC1 use csprintf() when the format is (as usual) a const string in flash.

   

Greetings from John von Neumann 😉

   

 

   

Bob

0 Likes