This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sprintf() problem.

Hi!

Can you please tell me what is wrong in here:

/* An example from Cx51 userÂ's guide */

#include<stdio.h>
#include<float.h>

void main(void)
{
code char buf[100];
int n;
int a,b;
float pi;

a = 123;
b = 456;
pi = 3.14159;
n = sprintf(buf, "%f", 1.1);
}

It builds fine but when I start debugging the program throws me into disassembly window after first step. And nothing happens.

I need the sprintf function in my own project, and obviously, it doesnÂ't work in it. so I tried it in this simpler code and it doesnÂ't work here either.

Regards
Aki

0