<?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[Exe Hexadezimal abspeichern]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>Ich habe das Ziel eine Exe - Datei Hexadezimal abzuspeichern nur ich weiß nicht, wie ich den Inhalt Hexadezimal darstellen kann. Bis jetzt hab ichs folgender Weise probiert, was aber leider nicht geklappt hat:</p>
<pre><code class="language-cpp">#include &lt;fstream&gt;
#include &lt;string&gt;

using namespace std;

int main()
{
   ifstream In;
   ofstream Out;
   string Zeile;

   In.open( &quot;Test,exe&quot;, ios::binary );
   Out.open( &quot;Output.txt&quot;, ios::app );

   while( ! In.eof() )
   {
      getline( In, Zeile );
      for( unsigned int Count = 0; Count &lt; Zeile.length(); Zeile++ )
      {
         Out &lt;&lt; hex &lt;&lt; Zeile.at( Count );
      }
      Out &lt;&lt; &quot;\n&quot;;
   }
}
</code></pre>
<p>Das hat also wie gesagt nicht funktioniert gehabt, das resultat in der Output.txt war leider falsch. Weiß jemand, wie ich es sonst programmieren kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/247209/exe-hexadezimal-abspeichern</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 14:57:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/247209.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Aug 2009 16:12:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Exe Hexadezimal abspeichern on Fri, 07 Aug 2009 16:12:05 GMT]]></title><description><![CDATA[<p>Hallo Leute,</p>
<p>Ich habe das Ziel eine Exe - Datei Hexadezimal abzuspeichern nur ich weiß nicht, wie ich den Inhalt Hexadezimal darstellen kann. Bis jetzt hab ichs folgender Weise probiert, was aber leider nicht geklappt hat:</p>
<pre><code class="language-cpp">#include &lt;fstream&gt;
#include &lt;string&gt;

using namespace std;

int main()
{
   ifstream In;
   ofstream Out;
   string Zeile;

   In.open( &quot;Test,exe&quot;, ios::binary );
   Out.open( &quot;Output.txt&quot;, ios::app );

   while( ! In.eof() )
   {
      getline( In, Zeile );
      for( unsigned int Count = 0; Count &lt; Zeile.length(); Zeile++ )
      {
         Out &lt;&lt; hex &lt;&lt; Zeile.at( Count );
      }
      Out &lt;&lt; &quot;\n&quot;;
   }
}
</code></pre>
<p>Das hat also wie gesagt nicht funktioniert gehabt, das resultat in der Output.txt war leider falsch. Weiß jemand, wie ich es sonst programmieren kann?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1757020</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757020</guid><dc:creator><![CDATA[*&#x5C;Thor&#x2F;*]]></dc:creator><pubDate>Fri, 07 Aug 2009 16:12:05 GMT</pubDate></item><item><title><![CDATA[Reply to Exe Hexadezimal abspeichern on Fri, 07 Aug 2009 16:23:47 GMT]]></title><description><![CDATA[<p>Ich würde mich gar nicht mit dem string behängen.</p>
<pre><code class="language-cpp">char ch;
   while( in.get(ch) )
      Out &lt;&lt; hex &lt;&lt; ch;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1757026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757026</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Fri, 07 Aug 2009 16:23:47 GMT</pubDate></item><item><title><![CDATA[Reply to Exe Hexadezimal abspeichern on Sat, 08 Aug 2009 13:55:48 GMT]]></title><description><![CDATA[<p>Das hat leider nicht ganz geklappt. Das ganze wurde nicht Hexadezimal abgespeichert, sondern 1zu1 von der Exe kopiert. Mein jetziger Code:</p>
<pre><code class="language-cpp">#include &lt;fstream&gt;

using namespace std;

int main()
{
   ifstream In;
   ofstream Out;
   char ch;

   In.open( &quot;Test.exe&quot;, ios::binary );
   Out.open( &quot;Output.txt&quot;, ios::app );

  while( In.get(ch) )
      Out &lt;&lt; hex &lt;&lt; ch;
}
</code></pre>
<p>Auszug aus der Output.txt</p>
<blockquote>
<p>MZ   ÿÿ ¸ @ € º ´ Í!¸LÍ!This program cannot be run in DOS mode.</p>
<p>$ PE L ƒB|J à 8 R Š X €  p @        ÔÂ       ø .text DP  R  <code>P</code>.data  p  V @ 0À.rdata 0+ € , X @ 0@.bss €V ° € @À.idata ø <br />
„ @ 0À U‰åƒì‰]ø‹E1Û‰uü‹ 1ö‹ =‘ ÀwC= Àr[¾ Ç 1Ò‰TèÄ ƒøtz…ÀtÇ ÿÐ»ÿÿÿÿ‰Ø‹uü‹\]ø‰ì\]Â =” ÀtÂwJ=“ Àt´‰Ø‹uü‹\]ø‰ì\]Â = Àt\[= ÀuÅÇ 1ö‰tè` ƒøtj…ÀtªÇ ÿÐëš=– ÀëÑÇ ¸ ‰Dè0 …ö„vÿÿÿèþ élÿÿÿÇ 1À‰Dè ƒøt0…À„RÿÿÿÇ ÿÐé?ÿÿÿÇ ¹ ‰LèÜ€ é%ÿÿÿÇ ¸ ‰DèÂ€ éÿÿÿ¶ ¼' U‰åSƒìÇ$ @ èí ƒìè…ü è€ý ÇEø Eø‰D¡ pD Ç°D ‰DEô‰D¸ °D ‰Dèu€ ¡ûD …Àtd£°pD ‹€E …Ò…¡ ƒúàt¡ûD ‰D¡€E ‹@0‰è3€ ‹€E ƒúÀt(¡ûD ‰D¡€E ‹@P‰è€ ë  
èó ‹°pD ‰èžû ƒäðèvû èÉ ‹ ‰D¡ °D ‰D¡°D ‰èU2 ‰Ãè</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1757403</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757403</guid><dc:creator><![CDATA[*&#x5C;Thor{*]]></dc:creator><pubDate>Sat, 08 Aug 2009 13:55:48 GMT</pubDate></item><item><title><![CDATA[Reply to Exe Hexadezimal abspeichern on Sat, 08 Aug 2009 14:16:56 GMT]]></title><description><![CDATA[<p>Ein char wird immer als char ausgegeben. Der Manipulator hex wirkt nur auf zahlen. Zudem möchtest du wahrscheinlich immer zwei Zeichen pro Byte ausgeben, mit einer Null als Füllzeichen:</p>
<pre><code class="language-cpp">Out &lt;&lt; setfill('0') &lt;&lt; setw(2) &lt;&lt; hex &lt;&lt; (int)ch;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1757407</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757407</guid><dc:creator><![CDATA[lagalopex]]></dc:creator><pubDate>Sat, 08 Aug 2009 14:16:56 GMT</pubDate></item><item><title><![CDATA[Reply to Exe Hexadezimal abspeichern on Sat, 08 Aug 2009 16:13:43 GMT]]></title><description><![CDATA[<p>Ahh Ok danke. Das klappt schon ganz gut jetzt^^ Das einzigste Problem, das ich noch habe ist, dass das ganze nicht äuquivalent zu dem ist, was mir ein Hex-Editor ausgibt.</p>
<p>HexEditor:</p>
<blockquote>
<p>4D5A90000300000004000000FFFF0000</p>
</blockquote>
<p>Output.txt:</p>
<blockquote>
<p>4d5affffff90000300000004000000ff</p>
</blockquote>
<p>Es sind immer mal wieder solche &quot;f&quot; - Reihen in der Outputfile zu finden, die mir der Hex Editor nicht anzeigt. Weiß jemand wieso?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1757452</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757452</guid><dc:creator><![CDATA[*&#x5C;Thor*&#x2F;]]></dc:creator><pubDate>Sat, 08 Aug 2009 16:13:43 GMT</pubDate></item><item><title><![CDATA[Reply to Exe Hexadezimal abspeichern on Sat, 08 Aug 2009 16:25:13 GMT]]></title><description><![CDATA[<p>Hm, dass ist das blöde bei <code>signed char</code> -&gt; <code>int</code> , hab ich vergessen.</p>
<pre><code class="language-cpp">Out &lt;&lt; setfill('0') &lt;&lt; setw(2) &lt;&lt; hex &lt;&lt; (((int)ch) &amp; 0xff);
</code></pre>
<p>Das sollte jetzt nur das letzte Byte aus dem <code>int</code> berücksichtigen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1757458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757458</guid><dc:creator><![CDATA[lagalopex]]></dc:creator><pubDate>Sat, 08 Aug 2009 16:25:13 GMT</pubDate></item><item><title><![CDATA[Reply to Exe Hexadezimal abspeichern on Sat, 08 Aug 2009 16:53:36 GMT]]></title><description><![CDATA[<p>Vielen Dank, es stimmt jetzt alles.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1757474</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1757474</guid><dc:creator><![CDATA[*&#x5C;Thor*&#x2F;]]></dc:creator><pubDate>Sat, 08 Aug 2009 16:53:36 GMT</pubDate></item></channel></rss>