摘要: strdup与strcpy具体的区别,以及在不同操作系统下的使用。 strdup 原型:extern char *strdup(char *s); 用法:#include <string.h> 功能:复制字符串s 说明:返回指向被复制的字符串的指针,所需空间由malloc()分配且可以由free()释放。 举例: // strdup.c [cpp] #include <string.h> #include <stdio.h> int main(void) { char *from = "Golden Global View"; char 阅读全文
posted @ 2013-04-12 17:07 功夫 熊猫 阅读(2182) 评论(0) 推荐(0)