Simple, simple, simple... All I want to do is return a String (big S) from a function. Here is the simplest program that demonstrates the problem. I have been working on this simple problem for several hours over 2 days! I have seen a hundred different explanations (and tried ALL of them) and suggestions.
Why is it so difficult to convert the macStr[18] to a String and return it?
untested, honestly I'm not sure if you can get away with declaring an object static. Generally, what is happening is that all dynamic data is de-allocated when you return from a function. So if you return an object referenced in a function, it may not exist.
Me too. Or, I would just not use String at all, make the char array static and deal with char arrays exclusively. Return a pointer to the char array instead.
There probably is a "right" way to do it, this is at the edge of my expertise.
I was overflowing the buf and stomped on some memory somewhere which explains the garbage in the output. If the program had just crashed it probably would have been easier to figure out, lol!