This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Store "XML" in buffer, invalid characters??

Hi,

I need to store some "XML" data in a buffer, to send over serial.

I have some trouble with storing this variable, due to some symbols.

char N_Pos0[150] = "<txid id="@#@#@" no="1"><command><c9 s="1" m="0" c="1" p1="0" p2="0" p3="0" p4="0" cs="1|0|1|0|0|0|0|0">0</c9></command></txid>";

Any idea how to store this data correctly?

Regards, David

Parents
  • char N_Pos0[150] = "<txid id="@#@#@" no="1"><command><c9 s="1" m="0" c="1" p1="0" p2="0" p3="0" p4="0" cs="1|0|1|0|0|0|0|0">0</c9></command></txid>";

    Let's post that as code, so we can see it properly:

    char N_Pos0[150] = "<txid id="@#@#@" no="1"><command><c9 s="1" m="0" c="1" p1="0" p2="0" p3="0" p4="0" cs="1|0|1|0|0|0|0|0">0</c9></command></txid>";

    Note that the double-quote character is the C string delimeter - so, if you want quotes within your string, you will need to escape them ...

Reply
  • char N_Pos0[150] = "<txid id="@#@#@" no="1"><command><c9 s="1" m="0" c="1" p1="0" p2="0" p3="0" p4="0" cs="1|0|1|0|0|0|0|0">0</c9></command></txid>";

    Let's post that as code, so we can see it properly:

    char N_Pos0[150] = "<txid id="@#@#@" no="1"><command><c9 s="1" m="0" c="1" p1="0" p2="0" p3="0" p4="0" cs="1|0|1|0|0|0|0|0">0</c9></command></txid>";

    Note that the double-quote character is the C string delimeter - so, if you want quotes within your string, you will need to escape them ...

Children
Related