Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

sprintf

$
0
0
     
Hello:
 
When i try to compile:
 
      char tmp[16];
      char format[128];
      uint16_t precision = 10;
      sprintf(format, '%%.%dX', precision);
 
 
I get the following warning:
 
Command.cpp: In member function 'void Command::print_number(uint8_t, uint8_t, uint8_t)':
Command.cpp:136:42: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
/home/can/dev/energia-0101E0012/hardware/tools/msp430/bin/../lib/gcc/msp430/4.6.3/../../../../msp430/include/stdio.h:51:44: error:   initializing argument 2 of 'int sprintf(char*, const char*, ...)' [-fpermissive]
Command.cpp:138:31: error: invalid conversion from 'uint8_t {aka unsigned char}' to 'const char*' [-fpermissive]
/home/can/dev/energia-0101E0012/hardware/msp430/cores/msp430/WString.h:59:2: error:   initializing argument 1 of 'String::String(const char*)' [-fpermissive]
 
I am printing numbers (uint8_t) to a nokia 5110 lcd. i need them left padded, since the lcd will not delete the old print like if you get a value like 200 then 15 - it will show 150 - since the last 0 is from 200.
 
I was trying to find a solution to that problem. 
 
Best
 
 
 
 

Viewing all articles
Browse latest Browse all 2077

Trending Articles