Implemenatation of Printf

S

Sandeep Chikkerur

Hi,

How printf is implemented ?
i.e, when we use printf, what goes inside to actually print the
charecters to the console ?


Thanks
Sandeep
 
H

hari4063

It depends from lib to lib, but mostly printf will call some helper
function like vfprintf that can print to file. So printf can just call
this with stdout. Now Your question will be how that helper function is
implemented? Who knows, look at lib source if yours compiler provide this
(gcc, borland, vc++ have sources for lib, so look at source).

Best,
Zaharije Pasalic
 
A

ankisharma

you can look at the section 7.2 of K&R( if you don't have the book then
I can paste that section for you). It has minimal implementation of
printf. But if you want to look at the implementation of this function
in your library then you have to dig out the source for this.
 
M

marlaque

Sandeep said:
Hi,

How printf is implemented ?
i.e, when we use printf, what goes inside to actually print the
charecters to the console ?


Thanks
Sandeep

If you have access to gcc then you can also poke around and find the
source to this one implementation. As others have already said, there's
no guarantee that all compilers will implement the same methedology.
 

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,161
Messages
2,570,892
Members
47,427
Latest member
HildredDic

Latest Threads

Top