How to insert a comma into a string

Hello, So i have for exemple: (char) 4349158 and i want to set it like this: 43.49158. Any ideas? thx

The simplest way is to copy the string into a new buffer in two parts, inserting the comma between them. If the original buffer is big enough, you can also use memcpy to shift the second part of the string one character to the right which gives you space to insert the comma. Remember to copy the null terminator as well as the content.

Callu:
Hello,
So i have for exemple: (char) 4349158 and i want to set it like this: 43.49158.
Any ideas?
thx

void add_char (char *string, char what, uint8_t where)
{
    char *buffer;
    uint8_t n, x, len;

    len = strlen (string); /* get length of incoming string */

    buffer = (char *) malloc ( (len + 1) * sizeof (char *)); /* create a temp buffer */

    if (!buffer) {
        return; /* if malloc failed, don't do anything */
    }

    n = 0;

    for (x = 0; x < len; x++) {
        if (x == where) {
            buffer[n++] = what; /* add in special character */
        }

        buffer[n++] = string[x]; /* copy string to buffer */
    }

    strncpy (string, buffer, (len + 1)); /* copy new string to old */
    free (buffer); /* deallocate buffer */
    return;
}

thx buds

Finally i tried out a different solution: my initial variable had a definite number of digits, so i did like this:

flat= (float)lat;
flat= flat / 100000;
Serial.print("flat= ");
Serial.println(flat, 5);

and then i transform it again in char