| | |
Question about Standard C Library.
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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!.
one place to get the documentation is google man pages.
Another place is the links in this thread
C Syntax (Toggle Plain Text)
google man printf
Another place is the links in this thread
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
•
•
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.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
•
•
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.
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
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.
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
•
•
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 10:12 pm.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
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
| Thread Tools | Search this Thread |
adobe ansi api array arrays bash binarysearch centimeter char convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic fflush file floatingpointvalidation fork frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling hardware highest homework i/o ide inches infiniteloop initialization interest kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives match matrix meter microsoft motherboard multi mysql odf open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer pointers posix power probleminc program programming pyramidusingturboccodes read recursion recv repetition scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string strings structures suggestions systemcall test testautomation unix urboc user voidmain() wab win32api windows.h






