473,385 Members | 1,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

printf code

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
4 7327
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
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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Manohar S | last post by:
It is a problem related to printf, and buffering to the printf statements Look through this program. main() { int pid; int loop,max=3; for(loop = 0; loop <max;loop++) { pid = fork();
11
by: Grumble | last post by:
Hello, I have the following structure: struct foo { char *format; /* format string to be used with printf() */ int nparm; /* number of %d specifiers in the format string */ /* 0 <= nparm <=...
4
by: ben | last post by:
why is it, in the below code, when there's a printf statement (the one commented with /* ****** */) the final for loop prints out fine, but without the commented with stars printf statement...
8
by: aditya | last post by:
hi, Can anybody please tell me that how the following printf(...) statement works- main(){ int d=9; printf("%d",printf("%d")); return 0;
31
by: muralipmanohar | last post by:
Hello all , I need a help on this code kindly help me out for the below code I worked on the Turboc the result I was expecting was different from what has been printed I have indicated the line...
9
by: Eric Lilja | last post by:
Hello, I have two code snippets I want you to look at. My program compiles without warnings (warning level set to max, gcc 3.4.3) with either snippet but the latter one causes a segfault at...
7
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
188
by: infobahn | last post by:
printf("%p\n", (void *)0); /* UB, or not? Please explain your answer. */
29
by: whatluo | last post by:
Hi, c.l.cs I noticed that someone like add (void) before the printf call, like: (void) printf("Timeout\n"); while the others does't. So can someone tell me whether there any gains in adding...
1
by: linq936 | last post by:
Hi, I read in many places that the string to be outputted by printf() must be ending with newline, for example, it should be printf("Hello World.\n"); instead of printf("Hello World.");
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.