<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to convert MiFare Classic UID read to character  in NFC</title>
    <link>https://community.nxp.com/t5/NFC/How-to-convert-MiFare-Classic-UID-read-to-character/m-p/648969#M1682</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nxp Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm currently using the NFC Reader Library for Linux Example 4 for MiFare Classic 1k tag and I'm trying to convert the UID and store the data read to a const character variable (so I can parse the data using socket to my application on the PC).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, after multiple tries of type casting to char, char array, pointer of char or even using itoa method (even though the UID is of unsigned integer of 8 bytes), I still can't get it to work:smileycry:&amp;nbsp;I am unsure if I missed out anything or misinterpreted the UID data type as when i do casting, it shows me&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;or&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;warning: assignment makes pointer from integer without a cast&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to C and this is a huge hurdle for me.. Any help or examples to convert would be greatly appreciated and feel free to let me know should the code for sending data via socket is needed for reference. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 18 Feb 2017 18:43:44 GMT</pubDate>
    <dc:creator>cyndi</dc:creator>
    <dc:date>2017-02-18T18:43:44Z</dc:date>
    <item>
      <title>How to convert MiFare Classic UID read to character</title>
      <link>https://community.nxp.com/t5/NFC/How-to-convert-MiFare-Classic-UID-read-to-character/m-p/648969#M1682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Nxp Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm currently using the NFC Reader Library for Linux Example 4 for MiFare Classic 1k tag and I'm trying to convert the UID and store the data read to a const character variable (so I can parse the data using socket to my application on the PC).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, after multiple tries of type casting to char, char array, pointer of char or even using itoa method (even though the UID is of unsigned integer of 8 bytes), I still can't get it to work:smileycry:&amp;nbsp;I am unsure if I missed out anything or misinterpreted the UID data type as when i do casting, it shows me&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;or&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;warning: assignment makes pointer from integer without a cast&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm new to C and this is a huge hurdle for me.. Any help or examples to convert would be greatly appreciated and feel free to let me know should the code for sending data via socket is needed for reference. Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Feb 2017 18:43:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/How-to-convert-MiFare-Classic-UID-read-to-character/m-p/648969#M1682</guid>
      <dc:creator>cyndi</dc:creator>
      <dc:date>2017-02-18T18:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert MiFare Classic UID read to character</title>
      <link>https://community.nxp.com/t5/NFC/How-to-convert-MiFare-Classic-UID-read-to-character/m-p/648970#M1683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Cyndi L,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From your description it is not clear what kind of conversion / casting you want to do, or what format is required for the intended parsing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you want to have the UID as a string of printable ASCII characters?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that is the case there is not a direct method or casting to do that, so it involves a custom function or loop procedure. For example you can do it like next:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;uint8_t loop&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;char&lt;/SPAN&gt; UID_string&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;PHAC_DISCLOOP_I3P3A_MAX_UID_LENGTH&lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;loop &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; loop &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; sDiscLoop&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sTypeATargetInfo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;aTypeA_I3P3&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;bUidSize&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; loop&lt;SPAN class="operator token"&gt;++&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp; &lt;SPAN class="token function"&gt;sprintf&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;UID_string &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; loop&lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"%02X"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sDiscLoop&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sTypeATargetInfo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;aTypeA_I3P3&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;aUid&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;loop&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;&lt;P&gt;Jorge Gonzalez&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Feb 2017 03:55:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/NFC/How-to-convert-MiFare-Classic-UID-read-to-character/m-p/648970#M1683</guid>
      <dc:creator>Jorge_Gonzalez</dc:creator>
      <dc:date>2017-02-23T03:55:07Z</dc:date>
    </item>
  </channel>
</rss>

