How do I see how stdio, say,works?

Feb 25, 2009 at 12:18pm
I'm trying to find out what the stdio functions look like, so I opened the .h file and started reading. The only useful thing I found, though, was the function prototypes. The included .h's didn't help me in this quest.
So I ask:
Where are those functions? What is their content? Why aren't they contained on the header?
Feb 25, 2009 at 12:36pm
The function bodies are in a library and they depend on the implementation.
You should look for some open source standard library so you can read the sourcecode.
The headers contain only the declarations or they will cause linker errors ("The symbol was already defined...")
The only headers with the implementation are those use templates (eg: STL headers) as template functions can't be implemented in file separated from the declaration
Feb 25, 2009 at 1:03pm
So, where can I find the <post header here> library code? Can I find stdio/math/whatever code on my PC?
Feb 25, 2009 at 1:28pm
You can download a version of the glibc source from rpmfind.net if using GCC.
Feb 25, 2009 at 1:37pm
So the code does not exist on my machine?
Feb 25, 2009 at 1:42pm
I don't think you have the standard library source on your computer,
to check it out, try looking on your compiler directories.
Last edited on Feb 25, 2009 at 1:42pm
Feb 25, 2009 at 1:55pm
Any leads? Like the file extension?
Feb 25, 2009 at 2:08pm
.c .C .cpp
They should be in C/C++ source files
Feb 25, 2009 at 2:35pm
Nah, don't bother. Compilers (specially proprietary compilers, but compilers in general) usually don't come with the source code for their libraries. Just follow the link jsmith gave you, but prepare to be overwhelmed.
Topic archived. No new replies allowed.