delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/15/06:14:05

From: "Robinson S." <roby AT lords DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Catenation (spelled right?) of strings
Date: Sat, 14 Aug 1999 23:53:23 -0400
Organization: ICAN.Net Customer
Lines: 51
Message-ID: <37B639B3.6BBE@lords.com>
References: <37B36D0D DOT 7F00 AT lords DOT com> <37B37890 DOT 2C249FED AT a DOT crl DOT com> <37B4490F DOT 1EB AT lords DOT com> <37B467D0 DOT B2496F3E AT americasm01 DOT nt DOT com>
NNTP-Posting-Host: dialin2001.toronto.globalserve.net
Mime-Version: 1.0
X-Mailer: Mozilla 3.04 (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Rolf Campbell wrote:
> 
> "Robinson S." wrote:
> 
> > > The correct thing to do is:
> > >   char *theString = "Goats " "make " "good " "pets!";
> >
> > Great, that seems to work. But, it brings up some other questions:
> > What if I want to add variables and strings to the char:
> > ---
> > char * ANIMAL = "Goats";
> > char *theString = ANIMAL "make " "good " "pets!";
> > ---
> > How would that be accomplished?
> 
>     That way is only for literal strings.  If you want to add variables,
> then you will have to use strcat.
> 
> > Also, can i modify *theString after having declared it as above, or has
> > it become a constant?
> 
>     You can modify theString, but not *theString.
> 
> --
>      -Rolf Campbell (39)3-6318

Ok... here is the code (... means other code that i did not include cus
this msg would be too long).

...

#include <string.h>

...

char path [255] = ("c:\\roby\\projects"); // PATH TO ICQ DIRECTORY
char path2 [255]= ("c:\\roby\\projects"); // UIN #
char file_txt1 = strcat (path, "\\test.txt");
char file_txt2 = strcat (path2, "\\temp.txt");

...

What do I change in above 4 lines to make it do what I want it to do?
That is: to give a string called file_txt1 the value of path and
"\\test.txt" put together. And give the string called file_txt2 the
value of path2 and "\\temp.txt" put together.

-- 

Robinson S.,
mailto:roby AT lords DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019