Shop OBEX P1 Docs P2 Docs Learn Events
New line characters — Parallax Forums

New line characters

HeavyHeavy Posts: 6
edited 2010-07-15 21:53 in Propeller 1
Hello,

· I have a string like:

data = 1,0 0,1·1,1 0,0 (this is just what·the string contains, not how I define it)

Can can use File_Append in·DataLogger_UART_Driver.spin to write this to a .csv as:

1,0 0,1·1,1 0,0

But I would like File_Append to write it his way:

1,0
0,1
1,1
0,0

What characters to I need to insert to do this. Or is there a better way?

I've tried the code below, but if that had worked I wouldn't be posting this. Thanks in advance.......Heavy
     '''''''(PST = Parallax Serial Terminal)      bytemove(@data + strsize(@data), PST#NL, strsize(PST#NL)+ 1)
     bytemove(@data + strsize(@data), PST#LF, strsize(PST#LF)+ 1)

Comments

  • MagIO2MagIO2 Posts: 2,243
    edited 2010-07-15 19:43
    You have to replace the spaces (= " " as character or 32 decimal) with carriage return (= 13 decimal).

    So, a simple loop with counter and accessing the string like it's an array:

    repeat i from 0 to strsize( @data )
    if data[noparse][[/noparse] i ] == " "
    data[noparse][[/noparse] i ] := 13
  • HeavyHeavy Posts: 6
    edited 2010-07-15 21:53
    Thanks, that helped a lot. I had to change the way I defined the array but I got it.


    Thanks
Sign In or Register to comment.