如何在我的系统(Mac OS)上找到C getchar()的实现?

  • 本文关键字:实现 getchar OS 系统 Mac c
  • 更新时间 :
  • 英文 :


我知道int getchar(void)是一个C库函数。

如何在我当前的 Mac OS 上找到它的实现?仅供参考,使用来自终端的"man getchar"我得到:

GETC(3)                  BSD Library Functions Manual                  GETC(3)
NAME
fgetc, getc, getc_unlocked, getchar, getchar_unlocked, getw -- get next character or word from input stream
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
int
fgetc(FILE *stream);
int
getc(FILE *stream);
int
getc_unlocked(FILE *stream);
int
getchar(void);
int
getchar_unlocked(void);
int
getw(FILE *stream);

如果你想看看Apple的实现,你必须看看他们的开源部分:

https://opensource.apple.com/source/Libc/Libc-1272.250.1/stdio/FreeBSD/getchar.c.auto.html

您可以在以下位置找到所有开源代码: opensource.apple.com

除非,通过实施,我们的意思是:

> nm /usr/lib/libcupscgi.dylib | grep "getchar"
U _getchar

最新更新