stdin.c

来自「一个MIPS模拟器的源码」· C语言 代码 · 共 41 行

C
41
字号
/* * Copyright (c) 2008 Martin Decky * All rights reserved. * * Distributed under the terms of GPL. * */#include "../stdin.h"#ifndef __WIN32__#include <unistd.h>#include <sys/select.h>bool stdin_poll(char *key){	/* Check new character */	fd_set rfds;	struct timeval tv;	/* Watch stdin */	FD_ZERO(&rfds);	FD_SET(0, &rfds);	tv.tv_sec = 0;	tv.tv_usec = 0;	int retval = select(1, &rfds, NULL, NULL, &tv);	if (retval == 1) {		/* There is a new character */		read(0, key, 1);		return true;	}		return false;}#endif /* __WIN32__ */

⌨️ 快捷键说明

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