I'm currently doing the pest, and I'm at the step which I have "to define a string called path that contains the concatenation of root (a global variable) and absolute-path."
As suggested, I'm using the strcat
function. The code compiles nicely but strcat
doesn't return a valide value.
Here's my code:
char croot[50], apath[50];
strcpy(croot, "/home/jhavard/Dropbox/CS50/pset6/pset6/public");
strcpy(apath, url);
char tmp = *strcat(croot, apath);
char path[] = {tmp};
printf("%s\n", path); // for debug
What am I doing wrong?