TCP-IP红宝书源代码

源代码在线查看: gets.c

软件大小: 1091 K
上传用户: gdmichael
关键词: TCP-IP 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* gets.c - gets */
				
				#define NULL    0
				#define CONSOLE 0
				#define	EOF	'\004'		/* control-d is end-of-file		*/
				
				/*------------------------------------------------------------------------
				 *  gets  -- gets string from the console device reading to user buffer
				 *------------------------------------------------------------------------
				 */
				char *gets(s)
				        char *s;
				{
					register c;
					register char *cs;
				
					cs = s;
				        while ((c = getc(CONSOLE)) != '\n' && c != '\r' && c != EOF)
						*cs++ = c;
					if (c==EOF && cs==s)
						return(NULL);
					*cs++ = '\0';
					return(s);
				}
							

相关资源