⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readstream.c

📁 tcpip协议第三卷源码,下载下来可直接编译
💻 C
字号:
/* * Copyright (c) 1996 W. Richard Stevens.  All rights reserved. * Permission to use or modify this software and its documentation only for * educational purposes and without fee is hereby granted, provided that * the above copyright notice appear in all copies.  The author makes no * representations about the suitability of this software for any purpose. * It is provided "as is" without express or implied warranty. */#include	"cliserv.h"intread_stream(int fd, char *ptr, int maxbytes){	int		nleft, nread;	nleft = maxbytes;	while (nleft > 0) {		if ( (nread = read(fd, ptr, nleft)) < 0)			return(nread);		/* error, return < 0 */		else if (nread == 0)			break;				/* EOF, return #bytes read */		nleft -= nread;		ptr   += nread;	}	return(maxbytes - nleft);		/* return >= 0 */}

⌨️ 快捷键说明

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