Go Down

Topic: Way to wrap long string? (Read 469 times) previous topic - next topic

paulb

May 29, 2007, 12:42 pm Last Edit: May 29, 2007, 12:43 pm by paulb Reason: 1
Is there a way to get a long string to wrap in the IDE? Putting in a return seems to
break strings.


wandrson

The only way I can think to do this in C/C++ is to physically break the strings and use the strcat function to recombine them.

I don't think there is a line continuation syntax within the C language definition that would help.

jims

You can do this...
Code: [Select]
const char longstring[] = "aaa"
   "bbb"
  "ccc";

but you might make sure to learn about <avr/pgmspace.h> and PROGMEM because otherwise your strings all get copied into SRAM and you don't have much of that.

paulb

#3
May 29, 2007, 08:56 pm Last Edit: May 29, 2007, 09:22 pm by paulb Reason: 1
Thanks jims - that was easy. I'll put it in the reference section.


PB

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy