Free2Code
The majority of forums are now only available as archives, which means posting/editing is disabled.

The Anything and Everything forum is still open.
 
Time: 2013-05-19, 07:37am
Printing integers without s/printf()
Subject: Printing integers without s/printf()  ·  Posted: 2006-09-14, 08:27am
Rank: ? (1)
Member #: 28473
Hello All. I am currently working on a custom library for a project and I have having trouble with a certain function. THis function was designed to to simply take an integer and print it to the screen. e.g. print_int(int x); The problem is that since this is a custom library, I cannot use the standard I/O and can only really, in my view, use write(). I was wondering if anyone could shed some light on this for me or offer advice. Thanks.

 
  Reply to this ·  Post link ·  Top
Subject: Re: Printing integers without s/printf()  ·  Posted: 2006-09-14, 11:18am
Rank: ? (119)
Member #: 28292
Excuse me. I can't help you in the moment and I can't understand you. These standard functions were written for purpose that a programmer should not write such functions again. Why should we create a bicycle? The writing of such functions will take a lot of time. Do you think the that everything in C libraries such as I/O is written in C?. No it isn't. The such delicate functions are written in assembly language using functions of BIOS. If you would write your function you will be forced implementing same methods which the developer of standart functions implemented. You can not use the standard I/O but you can use the function write() which is a standard output function. If you want to use this function why you cannot use other. The function write() as far as I know is used to write a file. By the way you will have to learn a lot of stuff to write this function. Did you use a debugger? Did you go into the output function? You will see how much of stuff is behind of this printf? Try it. Believe me. You will forget this idea immediately.

 
  Reply to this ·  Post link ·  Top

Pages: 1

Please login or register to post a reply.

Penguino AVR

Want to learn about robotics or microcontrollers?
Check out the Penguino AVR from our friends at
Icy Labs