Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!news.cs.indiana.edu!ux1.cso.uiuc.edu!osiris.cso.uiuc.edu!gordon From: gordon@osiris.cso.uiuc.edu (John Gordon) Newsgroups: comp.lang.c Subject: Re: help with strcat Message-ID: <1991Jun5.151513.5839@ux1.cso.uiuc.edu> Date: 5 Jun 91 15:15:13 GMT References: <1991Jun4.210209.28463@ux1.cso.uiuc.edu> Sender: usenet@ux1.cso.uiuc.edu (News) Distribution: comp Organization: University of Illinois at Urbana Lines: 16 >>could someone show me some example code to take >>two char strings and combine them into another char >>string. >char *str1 = "Joseph went"; >char *str2 ' " to the store."; >char str3[100]; >strcat(str3, str1); /* tacks str1 onto the end of str3 */ >strcat(str3, str2); /* tacks str2 onto the end of str3 */ >/* str3 should now be "Joseph went to the store." */ OK, OK, so I made a mistake. The first strcat() should be a strcpy(). John