|
发表于 2004-8-7 10:07:34
|
显示全部楼层
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main()
{
char *query,*sno,*sname,*temp;
query=malloc(100);
sno=malloc(9);
sname=malloc(10);
temp=malloc(2);
strcpy(sno,"011301144");
strcpy(sname,"qianqian");
strcpy(query,"INSERT INTO s VALUES(");
strcat(query,sno);
strcpy(temp,",");
strcat(query,temp);
strcat(query,sname);
strcpy(temp,")");
strcat(query,temp);
printf("The combined string is %s \n",query);
free(query);
free(sno);
free(sname);
free(temp);
return 1;
} |
|