append char array for SMS

It looks like SMS sending functions are based on char arrays less than 160 size. How to build up this char array ? Its easy to append strings with String class. Sprintf doesnt seem to work. Im ready to assign the entire array one char at at time, but I cant believe there isnt an easier way. Any ideas, examples, links would greatly appreciated.

Im ready to assign the entire array one char at at time, but I cant believe there isnt an easier way.

Believe it.

Not knowing how you want to build up your SMS character array we cannot be specific but have you looked at strlcpy, strlcat & itoa functions?

alex04032:
Sprintf doesnt seem to work.

sprintf() is there and works as advertised. Do you have a specific example of what doesn’t work for you? Also look at strncpy(), strncat(). Manipulating char arrays does take more care than using String, but it is also likely to be more memory-efficient.

You do still have the option of assembling your string using String objects, and then convert to a char array at the end.

Thanks guys, working with char and String, then converting all to char array will do the job.

Thanks guys, working with char and String, then converting all to char array will do the job.

Right up to the point where the String class has fragmented memory so bad you can't do anything, you mean.

alex04032: It looks like SMS sending functions are based on char arrays less than 160 size. How to build up this char array ? Its easy to append strings with String class.

Use strcat?

Sprintf doesnt seem to work.

Please post code demonstrating this. sprintf works. Or at least that will be my position until proven otherwise. :)

You guys are correct again. I was wondering where my gibberish LCD displays were coming after the data accumulation loop had been running over-night. I suspect String memory issues, and so I will re-program using char arrays. Thank you !