Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1683846
  • 博文数量: 210
  • 博客积分: 10013
  • 博客等级: 上将
  • 技术积分: 2322
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-25 15:56
文章分类

全部博文(210)

文章存档

2011年(34)

2010年(121)

2009年(37)

2008年(18)

我的朋友

分类: C/C++

2010-07-21 08:53:50

void *memcpy(void *dest,const void *src,size_t count){
    char *pdest = static_cast<char*>(dest);
    const char *psrc = static_cast<const char*>(src);
    while(*psrc!='\0'){
        *pdest++=*psrc++;
    }
    *pdest = '\0';
    return dest;
}
int main(int argc, _TCHAR* argv[])
{
    char *from = "helloworld";
    char *aim = new char[sizeof(from)+1];
    char *temp = static_cast<char*>(memcpy(aim,from,sizeof(from)));
    cout<<temp<<endl;
}


阅读(613) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~