substr.c

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· C语言 代码 · 共 32 行

C
32
字号
#ifndef lintstatic	char	*sccsid = "@(#)substr.c	4.1	(ULTRIX)	7/17/90";#endif lint/*	Place the `len' length substring of `as' starting at `as[origin]'	in `aresult'.	Return `aresult'.   Note: The copying of as to aresult stops if either the	specified number (len) characters have been copied,	or if the end of as is found.	A negative len generally guarantees that everything gets copied.*/char *substr(as, aresult, origin, len)char *as, *aresult;int origin;register unsigned len;{	register char *s, *result;	s = as + origin;	result = aresult;	++len;	while (--len && (*result++ = *s++)) ;	if (len == 0)		*result = 0;	return(aresult);}

⌨️ 快捷键说明

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