C语言库函数的原型,有用的拿去

源代码在线查看: strncpy.c

软件大小: 3272 K
上传用户: kens
关键词: C语言 库函数 原型
下载地址: 免注册下载 普通下载 VIP

相关代码

				/***
				*strncpy.c - copy at most n characters of string
				*
				*       Copyright (c) Microsoft Corporation. All rights reserved.
				*
				*Purpose:
				*       defines strncpy() - copy at most n characters of string
				*
				*******************************************************************************/
				
				#include 
				#include 
				
				/***
				*char *strncpy(dest, source, count) - copy at most n characters
				*
				*Purpose:
				*       Copies count characters from the source string to the
				*       destination.  If count is less than the length of source,
				*       NO NULL CHARACTER is put onto the end of the copied string.
				*       If count is greater than the length of sources, dest is padded
				*       with null characters to length count.
				*
				*
				*Entry:
				*       char *dest - pointer to destination
				*       char *source - source string for copy
				*       unsigned count - max number of characters to copy
				*
				*Exit:
				*       returns dest
				*
				*Exceptions:
				*
				*******************************************************************************/
				
				char * __cdecl strncpy (
				        char * dest,
				        const char * source,
				        size_t count
				        )
				{
				        char *start = dest;
				
				        while (count && (*dest++ = *source++))    /* copy string */
				                count--;
				
				        if (count)                              /* pad out with zeroes */
				                while (--count)
				                        *dest++ = '\0';
				
				        return(start);
				}
							

相关资源