✔ 最佳答案
Can I answer this in English?? I have problem typing Chinese here.
2009-04-01 09:22:02 補充:
The following is mainly in the unix world but windows has its own counter parts and will be more or less the same.
For printf or scanf, these are wrappers. If you look into /usr/include/stdio.h, all these are redefined as __P. That is the generic entry point for all these IO routines. Most of these are handled by other system calls (note that printf and scanf are just library calls not system calls). These library calls (printf and scanf) are inside /usr/lib/libc.a (the .so version is the dynamic library just like .dll in windows).
If you want to see the code for these routines, you will have to download the source of the target system or find a book describing these routines in detail. In linux, different favor or version may have slightly different code (not likely for printf but very likely for others). Different linux will have different ways to download the code, RedHat will use SRPMs and Ubuntu you will have to apt-get (or dpkg).
Books that describe this in detail:
1. Lion's Commentary on Unix 6th Edition by John Lions
2. Design of the UNIX Operating System by Bech
Also, these code will call on more fundamental system calls. I don't know if you really want to get into all the details. However, if you do, the following book may help you.
The Design and Implementation of the 4.4 BSD Operating System by by Marshall Kirk McKusick
If you prefer to stay in the programming part (not the operating system part), the classic book of
The C Programming Language by Kernighan and Richie
will do just fine. There is a chapter describing how IO works (not very detail).
Have fun.
2009-04-01 09:25:36 補充:
For windows, you cannot see what's going on inside. All source codes belong to Microsoft.