<?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[PHP Funktionen in C++ mit der STL?]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe 4 Funktionen die ich in C++ haben möchte:<br />
1/ <a href="http://de3.php.net/manual/de/function.bin2hex.php" rel="nofollow">http://de3.php.net/manual/de/function.bin2hex.php</a><br />
2/ <a href="http://de3.php.net/manual/de/function.decoct.php" rel="nofollow">http://de3.php.net/manual/de/function.decoct.php</a><br />
3/ <a href="http://de3.php.net/manual/de/function.ord.php" rel="nofollow">http://de3.php.net/manual/de/function.ord.php</a><br />
4/ <a href="http://de3.php.net/manual/de/function.chunk-split.php" rel="nofollow">http://de3.php.net/manual/de/function.chunk-split.php</a></p>
<p>Nur da ich vorher nur im PHP Bereich war und erst jetzt mit C++ richtig angefangen habe, weiß ich noch nicht sehr viel darüber. Aber Funktion 2 habe ich mit stringstream und oct hinbekommen (kennt jemand ne bessere lösung? her damit :D) und Funktion 4 habe ich mit einer For-Schleife hinbekommen (Bessere Lösung, bitte sagen :))</p>
<p>Aber bei 1 und 3 hol ich mir einen Wolf. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> Wie sähen die in C++ aus?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/156225/php-funktionen-in-c-mit-der-stl</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 19:05:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/156225.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Aug 2006 19:26:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to PHP Funktionen in C++ mit der STL? on Mon, 14 Aug 2006 19:26:03 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich habe 4 Funktionen die ich in C++ haben möchte:<br />
1/ <a href="http://de3.php.net/manual/de/function.bin2hex.php" rel="nofollow">http://de3.php.net/manual/de/function.bin2hex.php</a><br />
2/ <a href="http://de3.php.net/manual/de/function.decoct.php" rel="nofollow">http://de3.php.net/manual/de/function.decoct.php</a><br />
3/ <a href="http://de3.php.net/manual/de/function.ord.php" rel="nofollow">http://de3.php.net/manual/de/function.ord.php</a><br />
4/ <a href="http://de3.php.net/manual/de/function.chunk-split.php" rel="nofollow">http://de3.php.net/manual/de/function.chunk-split.php</a></p>
<p>Nur da ich vorher nur im PHP Bereich war und erst jetzt mit C++ richtig angefangen habe, weiß ich noch nicht sehr viel darüber. Aber Funktion 2 habe ich mit stringstream und oct hinbekommen (kennt jemand ne bessere lösung? her damit :D) und Funktion 4 habe ich mit einer For-Schleife hinbekommen (Bessere Lösung, bitte sagen :))</p>
<p>Aber bei 1 und 3 hol ich mir einen Wolf. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /> Wie sähen die in C++ aus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1117235</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1117235</guid><dc:creator><![CDATA[PHP-Coder]]></dc:creator><pubDate>Mon, 14 Aug 2006 19:26:03 GMT</pubDate></item><item><title><![CDATA[Reply to PHP Funktionen in C++ mit der STL? on Mon, 14 Aug 2006 21:28:37 GMT]]></title><description><![CDATA[<p>zu 1.) bin2hex mit STL</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;bitset&gt;
#include &lt;sstream&gt;
#include &lt;stdexcept&gt;

std::string bin2hex( const std::string&amp; in )
{
    using namespace std;
    bitset&lt; 32 &gt; bs;
    {
        stringstream s( in );
        if( !(s &gt;&gt; bs) )
            throw exception( &quot;Fehler beim Lesen der Binärdaten&quot; );
    }
    stringstream s;
    if( !(s &lt;&lt; hex &lt;&lt; bs.to_ulong()) )
        throw exception( &quot;Fehler beim Schreiben im Hex-Format&quot; );
    return s.str();
}

int main()
{
    using namespace std;

    cout &lt;&lt; bin2hex(&quot;101101011100&quot;) &lt;&lt; std::endl;
    cout &lt;&lt; bin2hex(&quot;1011100011111100&quot;) &lt;&lt; std::endl;
    cout &lt;&lt; bin2hex(&quot;1000101111010010&quot;) &lt;&lt; std::endl;
    return 0;
}
</code></pre>
<p>Das ist zwar nicht exakt die beschriebenen PHP-Funktion, aber so erscheint's mir sinnvoll.</p>
<p>und zu 3.) ord</p>
<pre><code class="language-cpp">std::string str = &quot;Hello World&quot;;
int asciiWert = int( str[0] );  // wie ord( str )
</code></pre>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1117289</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1117289</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Mon, 14 Aug 2006 21:28:37 GMT</pubDate></item></channel></rss>