<?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[Bit shifts]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">How can I do a bit shift in Qt? The analogue in c++ is presented bellow as a part of code:</p>
<p dir="auto">@while(file &gt;&gt; i)<br />
{<br />
elements++;<br />
}@</p>
<p dir="auto">Thanks in advance.</p>
]]></description><link>https://forum.qt.io/topic/31047/bit-shifts</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 11:18:54 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/31047.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Aug 2013 17:14:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Bit shifts on Thu, 22 Aug 2013 23:13:47 GMT]]></title><description><![CDATA[<p dir="auto">create a subclass of QFile with the bit shift operators.</p>
<p dir="auto">An easier way to get the count of either lines, or entries per line would do what SGaist suggested where you read the file in line by line into multiple buffers or the whole file into one giant buffer.  Then use QString's split function with either the , or \n as your delimiter.  The split function returns a QStringList which contains a count.</p>
]]></description><link>https://forum.qt.io/post/192216</link><guid isPermaLink="true">https://forum.qt.io/post/192216</guid><dc:creator><![CDATA[Buckets]]></dc:creator><pubDate>Thu, 22 Aug 2013 23:13:47 GMT</pubDate></item><item><title><![CDATA[Reply to Bit shifts on Thu, 22 Aug 2013 21:56:40 GMT]]></title><description><![CDATA[<p dir="auto">Since it's a csv, you have a file text you could use "QTextStream":<a href="http://qt-project.org/doc/qt-4.8/qtextstream.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://qt-project.org/doc/qt-4.8/qtextstream.html</a>.</p>
<p dir="auto">But, if I have understood you correctly you want to count all the elements contained in your csv. You could read your file line by line in a QString, and use split with the delimiter to get the actual count of the elements per line.</p>
]]></description><link>https://forum.qt.io/post/192212</link><guid isPermaLink="true">https://forum.qt.io/post/192212</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 22 Aug 2013 21:56:40 GMT</pubDate></item><item><title><![CDATA[Reply to Bit shifts on Thu, 22 Aug 2013 21:47:09 GMT]]></title><description><![CDATA[<p dir="auto">I am trying to calculate the elements in the file. For more clarity see the code below:</p>
<p dir="auto">@int kmean_algorithm::calculateElementsInFile()<br />
{<br />
int numberOfElements = 0;<br />
int fileIterator<br />
QFile file("...\iris.csv");<br />
if(!file.open(QIODevice::ReadOnly))<br />
{<br />
QMessageBox::warning(0, "Error", file.errorString());<br />
}<br />
if(file.isOpen())<br />
{<br />
while(file &gt;&gt; fileIterator)<br />
{<br />
numberOfElements ++;<br />
}<br />
}<br />
file.close();<br />
}@</p>
<p dir="auto">The code provided is wrong and I realize it, as &gt;&gt; is from fstream (if I loaded the file with standard c++ as follows ifstream file(filename); there would be no problem), as I load the file using QFile it means that file &gt;&gt; fileIterator is impossible w.r.t the following error about types inequality:</p>
<p dir="auto">bq. error: no match for 'operator&gt;&gt;' (operand types are 'QFile' and 'int')</p>
<p dir="auto">Q: How can I make &gt;&gt; in my case to work? Any suggestion? Alternatives?</p>
]]></description><link>https://forum.qt.io/post/192209</link><guid isPermaLink="true">https://forum.qt.io/post/192209</guid><dc:creator><![CDATA[Mike_newbye]]></dc:creator><pubDate>Thu, 22 Aug 2013 21:47:09 GMT</pubDate></item><item><title><![CDATA[Reply to Bit shifts on Thu, 22 Aug 2013 21:42:50 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">You are not very clear. Are you trying to get data from a file or do bit shifting ?</p>
]]></description><link>https://forum.qt.io/post/192210</link><guid isPermaLink="true">https://forum.qt.io/post/192210</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Thu, 22 Aug 2013 21:42:50 GMT</pubDate></item><item><title><![CDATA[Reply to Bit shifts on Thu, 22 Aug 2013 21:26:22 GMT]]></title><description><![CDATA[<p dir="auto">The special staff is that in Qt file is @QFile@ and i is @int@</p>
]]></description><link>https://forum.qt.io/post/192207</link><guid isPermaLink="true">https://forum.qt.io/post/192207</guid><dc:creator><![CDATA[Mike_newbye]]></dc:creator><pubDate>Thu, 22 Aug 2013 21:26:22 GMT</pubDate></item><item><title><![CDATA[Reply to Bit shifts on Thu, 22 Aug 2013 18:29:16 GMT]]></title><description><![CDATA[<p dir="auto">Qt libs are usually used with C++. So you can do this as you do in C++.<br />
Or do you mean something specific?</p>
]]></description><link>https://forum.qt.io/post/192196</link><guid isPermaLink="true">https://forum.qt.io/post/192196</guid><dc:creator><![CDATA[koahnig]]></dc:creator><pubDate>Thu, 22 Aug 2013 18:29:16 GMT</pubDate></item></channel></rss>