scanf.c

来自「iccavr编译器下的源代码」· C语言 代码 · 共 38 行

C
38
字号
#include <stdarg.h>
#include <stdio.h>
#include <_const.h>
#include "_stdio.h"

static char c;

static char _geti(void)
	{
	char v;

	if (c)
		{
		v = c;
		c = 0;
		}
	else
		v = getchar();
	return v;
	}

static void _ungeti(char v)
	{
	c = v;
	}

int scanf(CONST char *fmt, ...)
	{
	va_list va;
	int n;

	c = 0;
	va_start(va, fmt);
	n = _scanf(_geti, _ungeti, fmt, va);
	va_end(va);
	return n;
	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?