C , ( , ......) , "". - (type *x) , , , , , malloc ( ) , char buf[size].
.
, sprintf ( ) . , strcat, , strcat "" , (ops!) , "" : , , , , strcat .
strcat char, strlen . ,
size_t l = strlen(new_fname);
new_fname[l++] = '/';
for(i = 0; fname_base[i] != 0; i++, l++) new_fname[l] = fname_base[i];
for(i = 0; testjpgstring[i] != 0; i++, l++) new_fname[l] = testjpgstring[i];
new_fname[l] = 0;
l... (testjpgstring = "_test.jpg" )
However, if your program is full of string manipulations, I suggest using a library for strings (for laziness I often use glib)
source
share