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
char i=100; sprintf (command, "Test %c", i); // command has changed
Hi Alex, Thank you for your help. It is a bit hard to explain without listing a large amount of source code here. What I initialy did is I took a function I wrote using C166 that uses a bunch of sprintf commands, and copied it into my C51 source code. Now, my sprintf commands that work fine with C166 don't work with C51. Is there a major difference? I would have thought that's an ANSI command and it should work the same way in every C compiler version. After executing the line:
sprintf (command, "Just a text");
I would have thought that's an ANSI command and it should work the same way in every C compiler version. This command is ANSI C patern. It's really strange the fact that you can't see it working. What is the simulator that you're attempting to watch it? - Alex
I am not using a simulator, I test the software directly with our custom hardware (works since a few years, no problem on that side), and show the variable on an attached display. Holger
Sorry but, in this case, if the code works out of the hardware ( simulation only ) I think an Emulator may help you catch what is going on with your hardware.