How can I place quote marks around a variable?

It had nothing directly to do with your originally stated problem.

Have you fixed the newline problem yet?

How do I stop it from making a new line?

Don't send it. Or strip it of before printing.

May I refer you back to reply #14? Make Data a c-string and make sure it doesn't contain a newline before the closing double quote. If you can't avoid it in the first place, strip it before adding the closing dquote and before display. Do something like Perl's chomp with your input.

You can also strip it right before display, if you are sure that your strings always end like '\n', '"', '\0': just move the last 2 chars one position backwards.

It may be that you have a CRLF style line ending and you'll need to shift 2 positions. Display the string as hex values on serial monitor first, to make sure.

By the way, did I mention that you should favour c-strings over String?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.