Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
I am trying to create a program that outputs strings and variables, and I can't seem to find a os function that will let me print a variable.

To print a string, I use os_PutStrFull();

But to print a variable, I don't know what to use. Is there a function for printing variables? If so, then thanks for helping me out.
cout << variable?? Are you talking c++?
No, C. Calculator 84 CE C. C toolchain C.
Mateo con lechuga would be able to answer this.
You can use sprintf like it's shown in second_counter2:
void os_PutVar(unsigned int nmbr) {
   char str[10];
   sprintf(str, "%u", nmbr);
idk if that works, I didn't try it.Tried and works.

Edit: 50 posts! \o/
Thanks for giving me the idea to be able to turn a variable into a string. I don't know why I didn't think of that. I was able to use itoa();.
Apparently, itoa(); is not used in toolchain. I am going to do some more research, but so far I am not able to output a variable.
dunlavdy wrote:
I am not able to output a variable.

LogicalJoe literally just gave you the code to do so. What could you possibly be having trouble with?
So I pasted his method into my program, and when I tried to "make" the file, it told me:

Warning: No function prototype "os_PutVar" in scope.

Even though the function is clearly in the program.

(I am a newb with this stuff so I don't know why it is saying that).
You need to tell the system that the function exists like this:
void os_PutVar(unsigned int nmbr);
This is called a prototype, put it at the top of the file, in the "Prototypes" section if you are using the blank toolchain example.
Holy shoot I totally forgot. Thanks so much.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum