Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>As I see you want to eliminate control ASCII symbols. You could do it in the following way:</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;QtCore/QString&gt; #include &lt;QtCore/QByteArray&gt; using namespace std; // test data from your comment char data[] = { 0x49, 0x46, 0x50, 0x4a, 0x4b, 0x51, 0x52, 0x43, 0x2c, 0x31, 0x32, 0x33, 0x2e, 0x34, 0x2c, 0x54, 0x2c, 0x41, 0x2c, 0x2b, 0x33, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x41, 0x2c, 0x2d, 0x33, 0x30, 0x2e, 0x30, 0x30, 0x2c, 0x41, 0x2a, 0x05, 0x0d, 0x0a }; // functor to remove control characters struct toAscii { // values &gt;127 will be eliminated too char operator ()( char value ) const { if ( value &lt; 32 &amp;&amp; value != 0x0d &amp;&amp; value != 0x0a ) return '.'; else return value; } }; int main(int argc,char* argv[]) { string s; transform( &amp;data[0], &amp;data[sizeof(data)], back_inserter(s), toAscii() ); cout &lt;&lt; s; // STL string // convert to QString ( if necessary ) QString str = QString::fromStdString( s ); QByteArray d = str.toAscii(); cout &lt;&lt; d.data(); // QString return 0; } </code></pre> <p>The code above prints the following in console:</p> <pre><code>IFPJKQRC,123.4,T,A,+30.00,A,-30.00,A*. </code></pre> <p>If you have continuous stream of data you'll get something like:</p> <pre><code>IFPJKQRC,123.4,T,A,+30.00,A,-30.00,A*. IFPJKQRC,123.4,T,A,+30.00,A,-30.00,A*. IFPJKQRC,123.4,T,A,+30.00,A,-30.00,A*. IFPJKQRC,123.4,T,A,+30.00,A,-30.00,A*. IFPJKQRC,123.4,T,A,+30.00,A,-30.00,A*. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload