Questions tagged [strcat]

A standard C function that appends a copy of the source string to the destination string.

The declaration of strcat function which is found in string.h is:

char *strcat(char *dest, const char *src)

This function appends the string pointed to by src to the end of the string pointed to by dest. Here,dest is a pointer to the destination array, which should contain a C string, and be large enough to contain the concatenated resulting string and src is the string to be appended. This should not overlap destination.

strcat returns a pointer to the resulting string dest.

For more information, check the man page.

529 questions
-4
votes
1 answer

Struggling with strcat function in C

I am really frusted with my program right now. I expect that the strcat function would simply concatenate the desired strings together but apparently the strcat function (when uncommented) doesn't get the concatenation correct, and somehow changes…
-4
votes
3 answers

explanation of strcat() output

this is one of the question from 295c #include #include main() { char *a="kammo DJ"; const char *b="roomies!!"; char *c; a=(char *)malloc(strlen(a) +…
akash
  • 1,801
  • 7
  • 24
  • 42
-5
votes
3 answers

use strcat with strcpy occur problems

I have a problem when use strcat function. I have no idea.please help me.thanks char dst[5]="hello"; char *a = "12345"; char *b = "54321"; //work strcat(strcpy(dst, a), b); printf("one==%s\n",dst); //error strcpy(dst, a); strcat(dst,…
cowry chen
  • 11
  • 1
-7
votes
2 answers

Problem of a string read in function system() (probably due to a bad malloc)

chain1 = (char *) malloc(5*sizeof(char*) + 1); strcat(chain1, "cp mediaPlayer.exe "); strcat(chain1, actual->chain); strcat(chain1, "\n"); system(chain1); Hi everyone, i have an issue with my actual…
Zerkioms
  • 7
  • 2
1 2 3
35
36