Pages: [1]   Go Down
Author Topic: Way to wrap long string?  (Read 404 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 267
dinosaur cork
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a way to get a long string to wrap in the IDE? Putting in a return seems to
break strings.

« Last Edit: May 29, 2007, 05:43:09 am by paulb » Logged

Austin, TX
Offline Offline
Jr. Member
**
Karma: 1
Posts: 94
Shh! I am hunting wabbit. Killlll the wabbit!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 203
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can do this...
Code:
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.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 267
dinosaur cork
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks jims - that was easy. I'll put it in the reference section.


PB
« Last Edit: May 29, 2007, 02:22:28 pm by paulb » Logged

Pages: [1]   Go Up
Jump to: