printf code

K

kavuri.rajasekhar

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.
 
K

Keith Thompson

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/>.
 
N

Neil

Keith said:
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.
 
S

santosh

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.
 
R

Rod Pemberton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,176
Messages
2,570,950
Members
47,503
Latest member
supremedee

Latest Threads

Top