-
Concatenating cstrings
Hello all. Im having trouble combining two c strings into one with a period in the middle. Heres what I have so far. I get errors on the line where i commented. Im not sure exactly how to approach the problem of combining them. Can I use the + operator like I am? Also cant use strcat so thats out =) Thanks all! (btw not looking for the code answer, just help in the direction on how i can accomplish this)
Code:
int stringCat(char filename[265], char suffix[10]){
filename = filename + "." + suffix; /// Heres where im looking for help
}
return filename;
}
-
you could go at it one character at a time...
-
You can create temporary char array to connect filename and suffix one by one. Then copy the temp char array into filename.
-
never thought of that =) Thanks all!