|
|
| Author |
Message |
everest
Joined: 31 May 2010
Posts: 96
|
|
Posted: 21 December 2010, 19:22 PM Post subject: Line Breaks? |
|
|
I'm working on a robotics application and need the ability to pass long strings to a servo controller to command up to 32 servos to move to certain positions. The problem is that these strings can get VERY long depending on the servo sequence I'm sending over.
I've quickly discovered that the Zbasic IDE seems to have a maximum length for any given line in the code. C and other language have options to break a single long line of executable code over several lines. Is there a way to do something similar in Zbasic? If not then how is it possible to actually define a string longer as long as several hundred characters?
-Jeff |
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Posts: 2593
Location: Portland, OR
|
|
Posted: 21 December 2010, 20:05 PM Post subject: Re: Line Breaks? |
|
|
| everest wrote: | | [T]he Zbasic IDE seems to have a maximum length for any given line in the code. | I'm fairly certain that the IDE doesn't impose a limit. However, the ZBasic compiler does. You can use the line continuation character (underscore at the end of the line) to create a statement that is logically a single statement but which spans several lines. This doesn't work, however, inside of a string. However, the compiler will concatenate constant strings separated by the ampersand or plus character into a single constant string. | Code: | Debug.Print "first part" & _
" second part" + _
" third part" | This will result in a single string being passed to the Debug.Print functionality.
| everest wrote: | | If not then how is it possible to actually define a string longer as long as several hundred characters? | Be aware that strings are limited to a maximum of 255 characters total (largely for backward compatibility with BasicX) no matter how they are constructed. If you need longer sequences of characters you'll have to implement something using RAM buffers. |
|
| Back to top |
|
 |
everest
Joined: 31 May 2010
Posts: 96
|
|
Posted: 21 December 2010, 20:53 PM Post subject: |
|
|
255 should be enough. Thanks Don!
-Jeff |
|
| Back to top |
|
 |
|