Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I find source code of printf in macOS?

Sorry for my bad english.

I’m using macOS 12.3 in M1 Pro MacBook Pro

I want to know about source code of printf in C standard library.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I can find stdio.h file in usr/include directory.

But I can’t find printf.c or stdio.c file in same directory.

And I think Apple Open Source’s printf.c is too complicate, dosen’t looks like a real code in macOS and dosen’t helpful for me. Is that Apple Open Source printf.c code is really used in macOS?

https://opensource.apple.com/source/xnu/xnu-201/osfmk/kern/printf.c.auto.html

>Solution :

The newest Apple Open Source libc implementation of vfprintf (which is the generic underlying function that plain printf calls) can be found here on opensource.apple.com.

It’s about 1400 lines, and yes, it is complex.

Some other alternate implementations (which are complex too) are:

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading