Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find the implementation of stdio.h? [duplicate]

Tags:

c

Possible Duplicate:
Where to find stdio.h functions implementations ?

Hi, I am trying to find the function definitions of the functions defined in stdio.h header file, I want to learn how functions like printf() is achieved, but I can't find any preprocessor directives link in stdio.h to the implementation file elsewhere. How can a C Compiler know where to find the implementations when there are no direct references to the function definition file? (I learned that .h file may accompany with a same name .c implementation file from an objective-c book.) Could you help me? Thanks! I am using GCC on Mac OS X.

like image 390
Oliver Avatar asked Jun 04 '11 01:06

Oliver


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 .

Are #include Stdio H and #include Stdio H same?

#include<stdio. h> means, during compilation preprocessor will search the stdio header file only in predefined path(/user/include/). whereas #include"stdio. h" preprocessor first search in present working directory, if stdio header file is not present there, it will search in the predefined path.

Where is Stdio H Visual Studio?

The File Stdio. h is included in the path C:\Program Files (x86)\Windows Kits\10\Include\10.0. 17134.0\ucrt.


2 Answers

FreeBSD's libc is pretty well laid out in its src repository.

http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/

e.g. for printf(3):

http://svnweb.freebsd.org/base/head/lib/libc/stdio/printf.c?view=markup

http://svnweb.freebsd.org/base/head/lib/libc/stdio/vfprintf.c?view=markup

like image 171
Sean Avatar answered Nov 14 '22 20:11

Sean


Try downloading source code for GLIBC library project. That's where definitions for standard functions are when using GCC compiler (and derivates).

like image 44
Pablo Santa Cruz Avatar answered Nov 14 '22 22:11

Pablo Santa Cruz