Hello Everybody,

I am working on a project and i want to compose one main string out of several substrings in C.

for example:
I have 3 variables:
Float Vx=1,66
Float Vy=1.55
Float Vz=2.3
My first step is to convert them to character arrays usin snprintf.

Then i want to compose one main string out of the substring and get the result: "1.66 1.55 2.3"

How can i achieve this by usin strncat??

Pleas help

Why strncat? Make a single (expected) string by a single snprintf call. What's a problem?

"After reading all the above posts once" you will know your question itself has your answer.
1>Convert float to string.
2>Concatenate using srtcat or strncat as said by you or snprintf as said by Arkm.

When you know everything did you try to google out first?I think you lost your patience in the last step. !!! ;)

Hey everybody,

Thnx for the replies and i indeed tried to use snprintf but i forgot to null-terminate the character strings so that gave a problem.

But thnx

This question has already been answered. Start a new discussion instead.