Go Down

Topic: Way to wrap long string? (Read 448 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