I need to convert a char array to string. Something like this:
char array[20]; char string[100]; array[0]=\'1\'; array[1]=\'7\'; array[2]=\'8\'; array[3]=\'
Assuming array is a character array that does not end in \0, you will want to use strncpy:
array
\0
strncpy
char * strncpy(char * destination, const char * source, size_t num);
like so:
strncpy(string, array, 20); string[20] = '\0'
Then string will be a null terminated C string, as desired.
string