今天突然心血來潮,想一睹c的輸入輸出庫函數具體實現,於是便搜尋,最後得知所有的庫函數源代碼都位於glibc中,只需要下載glibc包,然後解壓即可。
具體下載網址:http://ftp.gnu.org/gnu/libc/
基本輸入輸出函數我找了半天,最終還是找到位置了,位於glibc文件夾的stdio-common子文件夾中,下面爲scanf的源代碼:
int
__scanf (const char *format, ...)
{
va_list arg;
int done;
va_start (arg, format);
done = _IO_vfscanf (stdin, format, arg, NULL);
va_end (arg);
return done;
}
當然這只是其中某一函數,如要查看其他函數,就下載glibc庫吧
當然這是在linux下進行的,不知道windows有沒有對應的庫。