Where is `scanf` implementation source code?
6,042
It's in glibc
library scanf.c source
glibc
stands for GNU C Library. It is a C standard library implementation. It's not a part of the compiler, because you might have different implementations of it (like Microsoft C run-time for example) as well as different compilers (like clang
).
Related videos on Youtube
Author by
Markus
Updated on September 18, 2022Comments
-
Markus over 1 year
I want to find C source code for
scanf
implementation on Linux machine. Googling to findscanf
implementation does not tell me the way to find it. I tried to find that source code fromgcc
source tree usingctags
andcscope
, but I could not find it. Can anybody please tell me where isscanf
function definition, i.e. implementation source code?-
Alen Milakovic over 8 yearsYou can often obtain this information directly via your distribution. It's easy with Debian/Ubuntu, for example. What is your distribution?
-
Markus over 8 yearsIt's Ubuntu 12.04 LTS
-
-
Markus over 8 yearsThank you for quick answer! could you please elaborate why that source code is not included(?) in my gcc source tree? I don't know what
glibc
does(support) for my hello_world program. -
X Tian over 8 yearsIt's the primary library of functions and definitions for C programs. It contains the function you are looking for
scanf()
-
phk over 8 yearsJust worth pointing out that other C standard libraries and therefore
scanf
implementations exist as well, e.g. uClibc: github.com/ffainelli/uClibc/blob/master/libc/stdio/_scanf.c