strncpy.c
来自「test file nucleus source」· C语言 代码 · 共 85 行
C
85 行
/*************************************************************************** Copyright Mentor Graphics Corporation 2002* All Rights Reserved.** THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS* SUBJECT TO LICENSE TERMS.**************************************************************************//************************************************************************** FILE NAME VERSION** strncpy.c Nucleus Common Library 1.1** DESCRIPTION** This file contains the implementation of NCL_strncpy.** DATA STRUCTURES** None.** FUNCTIONS** NCL_strncpy** DEPENDENCIES** ncl.h* string.h* nucleus.h*************************************************************************/#define NU_NCL_SOURCE_FILE#include "ncl\inc\ncl.h"#include "ncl\inc\string.h"#include "plus\nucleus.h" /* MMU Support *//*************************************************************************** FUNCTION** NCL_strncpy** DESCRIPTION** Copy s2 to s1, and make sure that at EXACTLY n characters are* copied (padded with 0 if necessary). Does not always append a* null.** INPUTS** s1 Destination* s2 Source* n Number of bytes to copy** OUTPUTS** char* Pointer to result.**************************************************************************/char *NCL_strncpy(register char *s1, register const char *s2, register size_t n){ register char *p = s1; while (n > 0) { --n; if (!(*s1++ = *s2++)) break; } while (n-- > 0) *s1++ = 0; return p;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?