I have tried various ways of trying to do what PaulS said, but cannot figure out how to do it.I have googled arrays, pointers, chars and Strings, I do understand more but not yet enough to make the code work.And am now a bit overwhelmed by it all :~

If someone could help that would be appreciated, then when I have the answer I will google again to find out how it works.

I have solved that last problem, I remeber I had it before, if the following line was not at the end of the routine it would become corrupt,but have no idea why, but putting it at the end solves the text error.

client.publish("outTopic", payload, length); See the code below as it has a note about this.

Thanks for your time PaulS, it was most helpful.

Regards Gary

Added the working code here, for anyone that may read this in the future.