Mail Archives: djgpp/1999/08/15/06:14:05
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 -