posts - 12,  comments - 0,  trackbacks - 0
/****strcat.c - contains strcat() and strcpy()
*
*       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       Strcpy() copies one string onto another.
*
*       Strcat() concatenates (appends) a copy of the source string to the
*       end of the destination string, returning the destination string.
*
******************************************************************************
*/


#include 
<cruntime.h>
#include 
<string.h>

#ifndef _MBSCAT
#ifdef _MSC_VER
#pragma function(strcat,strcpy)
#endif  /* _MSC_VER */
#endif  /* _MBSCAT */

/****char *strcat(dst, src) - concatenate (append) one string to another
*
*Purpose:
*       Concatenates src onto the end of dest.  Assumes enough
*       space in dest.
*
*Entry:
*       char *dst - string to which "src" is to be appended
*       const char *src - string to be appended to the end of "dst"
*
*Exit:
*       The address of "dst"
*
*Exceptions:
*
******************************************************************************
*/


char * __cdecl strcat (
        
char * dst,
        
const char * src
        )
{
        
char * cp = dst;

        
while*cp )
                cp
++;                   /* find end of dst */

        
while*cp++ = *src++ ) ;       /* Copy src to end of dst */

        
return( dst );                  /* return dst */

}



/****char *strcpy(dst, src) - copy one string over another
*
*Purpose:
*       Copies the string src into the spot specified by
*       dest; assumes enough room.
*
*Entry:
*       char * dst - string over which "src" is to be copied
*       const char * src - string to be copied over "dst"
*
*Exit:
*       The address of "dst"
*
*Exceptions:
******************************************************************************
*/


char * __cdecl strcpy(char * dst, const char * src)
{
        
char * cp = dst;

        
while*cp++ = *src++ );               /* Copy src over dst */

        
return( dst );
}
posted on 2008-11-21 12:34 Benson 阅读(1686) 评论(0)  编辑 收藏 引用 所属分类: C/C++

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2008年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

常用链接

留言簿(1)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜