Gudday all
On a previous thread Extra characters in string I was given some help to extract and correctly terminate strings.
My next step is to concatenate two strings, comprising a path and a file name, and then move the file to the new location using rename() and so move the file to its new location.
I thought that I would make a new variable to hold the concatenated strings (path and file) and then put that new variable into rename().
When I build the code I get the error message in the strncat line " error: incompatible types in assignment of `char*' to `char[65]' ".Code:#include <cstring.h> const size_t size = 64; ... char move_tiff_file[size+1] = {0}; //final destination of TIFF file /* this var. added 05/08 */ ... /* these next 2 lines added 05/08 */ move_tiff_file = strncat(dest, tiff_file, size); rename(tiff_file, move_tiff_file);
Looking at a reference site for C and looking up strncat I see the following
dest and tiff_file are both char*#include <cstring>
char *strncat( char *str1, const char *str2, size_t count );
Q: What is the difference between char *str1 & const char *str2?
Q: What is wrong with either my definition of move_tiff_file or my handling of strncat?