more string hiccups
travis
Posts: 180
Trying to pad a string with spaces and put a CR on the end
I get all the spaces I need, but the carriage return won't go; or at least it doesn't show up in the variable debug.
edit: just made c_tmp a local_var instead of stack and it's working now. no idea.
DATA_EVENT[vdvBleh] { COMMAND: { STACK_VAR CHAR c_tmp[9] STACK_VAR INTEGER i3 c_tmp = DATA.TEXT WHILE(LENGTH_STRING(c_tmp) < 8){ c_tmp = "c_tmp,' '" } c_tmp = "c_tmp, $0d" } }
I get all the spaces I need, but the carriage return won't go; or at least it doesn't show up in the variable debug.
edit: just made c_tmp a local_var instead of stack and it's working now. no idea.
0
Comments
Edit:
Forget the above I see what you're doing now.
The code looks like it should work fine but you shouldn't be able to see the var in debug unless you're stepping through it using break points. Otherwise to view while developing you'll need to change it to a local as I see you did in your edit and change it back to a stack when it's working properly.
Either stack or local should work the same unless the data coming in is broken up and not in one chunk. Since this is a command handler that's not usually the case though.
And now I notice that the terminal actually shows a $0D when I send the string directly to it: