strncpy.c

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

C
34
字号
#ifndef lintstatic char *sccsid = "@(#)strncpy.c	4.1	(ULTRIX)	7/3/90";#endif not lint/* ------------------------------------------------------------------ *//* | Copyright Unpublished, MIPS Computer Systems, Inc.  All Rights | *//* | Reserved.  This software contains proprietary and confidential | *//* | information of MIPS and its suppliers.  Use, disclosure or     | *//* | reproduction is prohibited without the prior express written   | *//* | consent of MIPS.                                               | *//* ------------------------------------------------------------------ *//* $Header: strncpy.c,v 1.1 87/02/16 11:17:02 dce Exp $ *//* * Copy s2 to s1, truncating or null-padding to always copy n bytes * return s1 */char *strncpy(s1, s2, n)register char *s1, *s2;{	register i;	register char *os1;	os1 = s1;	for (i = 0; i < n; i++)		if ((*s1++ = *s2++) == '\0') {			while (++i < n)				*s1++ = '\0';			return(os1);		}	return(os1);}

⌨️ 快捷键说明

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