Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find stdio.h functions implementations?

Tags:

I study C and I noticed that I can't find the implementation file for some header files like, for example, stdio.h which is a library which contains a lot of input/output functions, like printf. Where can I find its implementation?

like image 367
prista Avatar asked Mar 08 '11 14:03

prista


People also ask

Where is the stdio.h file located?

In Ubuntu, which your original question indicated you're using, the “root” stdio. h file is in /usr/include .

What is #include stdio.h directory?

h> You tell the compiler to search for the file 'stdio. h' in the standard library folders only . but when you write #include”stdio. h” You mean that search the file 'stdio. h' in the standard library functions as well as in the current folder where you are working .

What is in the stdio.h library?

The stdio. h header defines three variable types, several macros, and various functions for performing input and output.

Which directive is #include stdio.h >?

In the following example, we are using the #include directive to include the stdio. h header file which is required to use the printf standard C library function in your application.


2 Answers

Download one of these:

  • glibc
  • uclibc
  • dietlibc
  • BSD libc

Or, even better, download several of these and compare their implementations. Of course, these are likely doing a lot of things different compared to your particular standard library implementation, but would still be quite interesting for e.g. non-platform-specific functionality such as sprintf.

like image 141
Erik Avatar answered Nov 05 '22 01:11

Erik


You need to find the source code for a C standard library like glibc: http://www.gnu.org/s/libc/

You can download the source here: http://ftp.gnu.org/gnu/glibc/ It contains source for all the library functions.

like image 26
Ben Avatar answered Nov 05 '22 01:11

Ben