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

Hello!

I am trying to use sprintf, but get no result (C51, version 5.20).

char xdata command [80], i=100;
strcpy (command, "Hello!"); // now command contains "Hello!"
sprintf (command, "Test %d", i); // command has not changed
Why would sprintf not work?
Thank you for any help!
Holger

Parents
  • "I display the content of my variable before and after the sprintf
    command."


    Are you sure that it's the sprintf not working; could it be a problem with your display routine?

    Have you tried it on the simulator, so that you can watch exactly what's going on?

    Do you use optimisation?
    If so, have you tried disabling it?

Reply
  • "I display the content of my variable before and after the sprintf
    command."


    Are you sure that it's the sprintf not working; could it be a problem with your display routine?

    Have you tried it on the simulator, so that you can watch exactly what's going on?

    Do you use optimisation?
    If so, have you tried disabling it?

Children
No data