<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[solved] &#x27;invalid conversion&#x27; issue]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I am having a 'invalid conversion' that I don't understand:</p>
<p dir="auto">Function:<br />
<a class="plugin-mentions-user plugin-mentions-a" href="/user/void">@<bdi>void</bdi></a> LongToAsciiQbArrayLeadZ(QByteArray * cAscii, ulong lLongVal, char cNbr)<br />
{<br />
while(cNbr--)<br />
{<br />
cAscii[cNbr] = (char)((lLongVal ) + '0');<br />
lLongVal /= 10;<br />
}<br />
}<br />
@</p>
<p dir="auto">Call:<br />
@QByteArray qbTempArray;<br />
LongToAsciiQbArrayLeadZ(&amp;qbTempArray, uLogCounter.l++, 10);@</p>
<p dir="auto">leads to:<br />
Warnung:array subscript has type 'char'<br />
Fehler:invalid conversion from 'char' to 'const char*'</p>
<p dir="auto">I just don't get what's wrong?<br />
Same works in native C with char array instead of QByteArray.<br />
Thanks, McL</p>
]]></description><link>https://forum.qt.io/topic/41141/solved-invalid-conversion-issue</link><generator>RSS for Node</generator><lastBuildDate>Thu, 11 Jun 2026 13:09:15 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/41141.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 08 May 2014 09:03:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [solved] &#x27;invalid conversion&#x27; issue on Thu, 08 May 2014 11:51:51 GMT]]></title><description><![CDATA[<p dir="auto">Works a treat! Thanks :)</p>
]]></description><link>https://forum.qt.io/post/227755</link><guid isPermaLink="true">https://forum.qt.io/post/227755</guid><dc:creator><![CDATA[McLion]]></dc:creator><pubDate>Thu, 08 May 2014 11:51:51 GMT</pubDate></item><item><title><![CDATA[Reply to [solved] &#x27;invalid conversion&#x27; issue on Thu, 08 May 2014 09:39:36 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">try modifying the code like this<br />
@<br />
void LongToAsciiQbArrayLeadZ(QByteArray &amp;cAscii, ulong lLongVal, char cNbr)<br />
{<br />
while(cNbr--)<br />
{<br />
cAscii[cNbr] = (char)((lLongVal ) + '0');<br />
lLongVal /= 10;<br />
}<br />
}<br />
@</p>
<p dir="auto">@<br />
QByteArray qbTempArray;<br />
LongToAsciiQbArrayLeadZ(qbTempArray, uLogCounter.l++, 10);<br />
@</p>
<p dir="auto">You used a QByteArray pointer.</p>
]]></description><link>https://forum.qt.io/post/227729</link><guid isPermaLink="true">https://forum.qt.io/post/227729</guid><dc:creator><![CDATA[mcosta]]></dc:creator><pubDate>Thu, 08 May 2014 09:39:36 GMT</pubDate></item></channel></rss>