By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

printf code

P: n/a
hai i am new to this group. can anyone give me the code for pritf
function.

my question is i need to write my own function for the printf statement.

Apr 15 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
ka***************@gmail.com writes:
hai i am new to this group. can anyone give me the code for pritf
function.

my question is i need to write my own function for the printf statement.


You posted the same question 3 times within a few seconds. Apparently
the Google interface makes that easy to do.

There's no such thing as *the* code for the printf function. The code
varies from from one implementation to another.

Why do you need to write your own printf function? Every C
implementation provides it; why reinvent the wheel?

And since you're posting through Google, please read
<http://cfaj.freeshell.org/google/>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Apr 15 '06 #2

P: n/a
Keith Thompson wrote:
ka***************@gmail.com writes:
hai i am new to this group. can anyone give me the code for pritf
function.

my question is i need to write my own function for the printf statement.


You posted the same question 3 times within a few seconds. Apparently
the Google interface makes that easy to do.

There's no such thing as *the* code for the printf function. The code
varies from from one implementation to another.

Why do you need to write your own printf function? Every C
implementation provides it; why reinvent the wheel?

And since you're posting through Google, please read
<http://cfaj.freeshell.org/google/>.

You could google for it.
I assume you know it is a large and complicated function.
Apr 15 '06 #3

P: n/a
ka***************@gmail.com wrote:
hai i am new to this group. can anyone give me the code for pritf
function.

my question is i need to write my own function for the printf statement.


Firstly posting multiple times in quick succession won't help you get
better responses; on the contrary many regulars will tend to ignore
you. Please read the following:

<http://cfaj.freeshell.org/google/>
<http://clc-wiki.net/wiki/Introduction_to_comp.lang.c>

Now coming to your question, the "code" for a printf() function will
vary from one implementation to another, so there is no such thing as
"the" code for a printf() function. If you're implementing the printf()
function as a part of a customised C implementation, then you should be
knowing how to go about it, not ask in a newsgroup.

On the other hand, if it is a learning exercise, you might try looking
at the source code of freely available C standard libraries like glibc,
dietlibc, mingw, DJGPP etc.

Apr 15 '06 #4

P: n/a

"santosh" <sa*********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
ka***************@gmail.com wrote:
hai i am new to this group. can anyone give me the code for pritf
function.

my question is i need to write my own function for the printf statement.

<snip> On the other hand, if it is a learning exercise, you might try looking
at the source code of freely available C standard libraries like glibc,
dietlibc, mingw, DJGPP etc.


In addition to Santosh's suggestions, there are many other printf style
functions with various licenses available as part of
large software packages. One example might be snprintf.c by Russ Allbery as
part of INND.

Chris Giese's Public Domain printf()
"lightweigth/stripped-down printf()" here
http://my.execpc.com/CE/AC/geezer/osd/libc/
directly: http://my.execpc.com/CE/AC/geezer/osd/libc/printf.c

MinGW has a Public Domain printf() as a part of their libraries
http://www.mingw.org/
Rod Pemberton
Apr 15 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.