•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 391,554 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,582 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:
Views: 1710 | Replies: 11
![]() |
Friends, I have a question:
Many times in books and tutorials I'm sent to consult the Standard C Library reference. Sometimes, references are made to some Standard C function.
Where do I see the Standard C Library in a compiler. I don't see any source code in my compiler that shows me for example how printf() or scanf() works. All that I see is header files.
Could anyone show me some light in the matter?. I would like to know how I can learn about the abilities of the functions I'm using, and not just follow like a sheep, what the book tells me to code.
Thank you!.
Many times in books and tutorials I'm sent to consult the Standard C Library reference. Sometimes, references are made to some Standard C function.
Where do I see the Standard C Library in a compiler. I don't see any source code in my compiler that shows me for example how printf() or scanf() works. All that I see is header files.
Could anyone show me some light in the matter?. I would like to know how I can learn about the abilities of the functions I'm using, and not just follow like a sheep, what the book tells me to code.

Thank you!.
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,542
Reputation:
Rep Power: 36
Solved Threads: 860
one place to get the documentation is google man pages.
Another place is the links in this thread
google man printf
Another place is the links in this thread
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
•
•
Join Date: May 2006
Location: Bellevue, WA
Posts: 1,548
Reputation:
Rep Power: 8
Solved Threads: 51
•
•
•
•
Many times in books and tutorials I'm sent to consult the Standard C Library reference. Sometimes, references are made to some Standard C function.
•
•
•
•
Friends, I have a question:
I would like to know how I can learn about the abilities of the functions I'm using, and not just follow like a sheep, what the book tells me to code.
how about trying the msdn website? you might not get the source code, but you can find about every function what are it's possible parameters, what values it returns, and many times it even shows examples.
www.msdn.co.il
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,542
Reputation:
Rep Power: 36
Solved Threads: 860
The problem with reading the standard itself is that the standard is written mostly for designers/writers of compilers. New programmer students will probably find it not-too-useful. I would rather read one of the many books you can buy or free e-books, which are written for people actually writing the programs.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
You are correct Ancient Dragon. I haven't learned enough to understand
most of what is in there. I'm learning now about functions and what they are, and I'm understanding them. So, I started asking myself about other functions already made, like strlen(), strcpy(), and so forth. But I don't see anywhere the actual code to know how these functions are structured. Same with printf() and scanf().
I guess I'm going to have to take it on faith and use them, even when I'm disappointed to learn that for example scanf() is not very good, for what I was using it for. Makes me wonder what else I learn in books that is not good. Thank goodness I never used gets(). :rolleyes:
I appreciate any help you guys are giving me. Thank you very much.
most of what is in there. I'm learning now about functions and what they are, and I'm understanding them. So, I started asking myself about other functions already made, like strlen(), strcpy(), and so forth. But I don't see anywhere the actual code to know how these functions are structured. Same with printf() and scanf().
I guess I'm going to have to take it on faith and use them, even when I'm disappointed to learn that for example scanf() is not very good, for what I was using it for. Makes me wonder what else I learn in books that is not good. Thank goodness I never used gets(). :rolleyes:
I appreciate any help you guys are giving me. Thank you very much.
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,542
Reputation:
Rep Power: 36
Solved Threads: 860
The actual code that implements the functions in stadnard libary are compiler-dependent -- the standards do not dictate how the functions are implemented, only what the functions should do. So one compiler might implement the functions differently then another compiler. You can get the source code for all compiler functions from GNU, which is open-source and free. But be prepared for some really nasty (
) reading!
Some of the functions, like strlen() are pretty simple. Others, like printf() family of functions, get pretty complicated and difficult for newbes to follow. So I'm not sure how useful the source code would be to you at your level of understanding. Many, if not most, of the functions in the C standard library were written over 20 years ago and tested in thousands, if not millions, of programs. So you can be well assured that they work correctly as designed and documented. This doesn't mean they are good functions to use, just that they work ok.
) reading!Some of the functions, like strlen() are pretty simple. Others, like printf() family of functions, get pretty complicated and difficult for newbes to follow. So I'm not sure how useful the source code would be to you at your level of understanding. Many, if not most, of the functions in the C standard library were written over 20 years ago and tested in thousands, if not millions, of programs. So you can be well assured that they work correctly as designed and documented. This doesn't mean they are good functions to use, just that they work ok.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
•
•
•
•
how about trying the msdn website? you might not get the source code, but you can find about every function what are it's possible parameters, what values it returns, and many times it even shows examples.
www.msdn.co.il
•
•
•
•
The problem with reading the standard itself is that the standard is written mostly for designers/writers of compilers. New programmer students will probably find it not-too-useful. I would rather read one of the many books you can buy or free e-books, which are written for people actually writing the programs.
While the standard doesn't have good example for each and every function, it is quite good at telling you exactly what ALL compilers have to do.
Whereas online references and even man pages sometimes tell you implementation-specific stuff too (whether or not you know it is left to the reader).
Or worse:
http://cppreference.com/stdio/printf.html
Can you spot the undefined behavior that is described there, if you implemented what was stated? Do you think a newb has a chance in hell of noticing?---
So my advice:
- Try to do something you want to do in code.
- Look up functions in the standard that you think are appropriate.
- Post question(s) to forum(s) such as this when things go awry -- after reading said site's FAQ.
Last edited by Dave Sinkula : Jan 11th, 2007 at 9:12 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
Similar Threads
- Pointers (archived tutorial) (C++)
- C++ Random Numbers (C++)
- HLA Standard Library at SF (Assembly)
- Pointers (C++)
Other Threads in the C Forum
- Previous Thread: putting image in my application program...
- Next Thread: plug in for RTF



Linear Mode