Can this function be more safer than sprintf()?
char * BufferInsertStringValue(char * s,int startingPosition, char * command) {
int i = 0;
int stringLength=strlen(s)-1;
for ( i = 0;i <= stringLength;i++) {
command[startingPosition + i - 1] = s[i];
}
command[startingPosition + i] = '\0';
return command;
}
where s is the temp array char and comando is the original text string which i want to concatenate with the integer value.
I call this function with:
char * vett;
vett = BufferInsertStringValue(temp, 14, sonar_center);
Do you think it's safer than sprintf function?