<?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[Erste Bytes einer Datei ändern]]></title><description><![CDATA[<p>Hallo.<br />
Ich habe auf einem ein paar Dateien, die mehrere GB groß sind. Das einzige Problem ist, dass sie einen kleinen Schönheitsfehler haben: Am Anfang - also wenn ich es im Hex-Editor lese - sind die ersten beiden Zahlen 00. Sie müssten aber korrekterweise 9A sein.<br />
Wenn ich nun bei einigen Dateien im Hex-Editor das abändere und die Datei speichere, dauert das SEEEEEEEEEEEEEHR lange, weil die ganze Datei kopiert würde. Gibt es eine Möglichkeit, nur diese ersten beiden Zahlen zu ändern?<br />
<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="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/258536/erste-bytes-einer-datei-ändern</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 09:52:08 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/258536.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 11 Jan 2010 21:42:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Erste Bytes einer Datei ändern on Mon, 11 Jan 2010 21:42:27 GMT]]></title><description><![CDATA[<p>Hallo.<br />
Ich habe auf einem ein paar Dateien, die mehrere GB groß sind. Das einzige Problem ist, dass sie einen kleinen Schönheitsfehler haben: Am Anfang - also wenn ich es im Hex-Editor lese - sind die ersten beiden Zahlen 00. Sie müssten aber korrekterweise 9A sein.<br />
Wenn ich nun bei einigen Dateien im Hex-Editor das abändere und die Datei speichere, dauert das SEEEEEEEEEEEEEHR lange, weil die ganze Datei kopiert würde. Gibt es eine Möglichkeit, nur diese ersten beiden Zahlen zu ändern?<br />
<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="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837158</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837158</guid><dc:creator><![CDATA[Hilfelos]]></dc:creator><pubDate>Mon, 11 Jan 2010 21:42:27 GMT</pubDate></item><item><title><![CDATA[Reply to Erste Bytes einer Datei ändern on Mon, 11 Jan 2010 22:13:10 GMT]]></title><description><![CDATA[<p>hmm keine ahnung aber vielleicht helfen memory mapped files weiter? Bei mehreren gb wohl allerdings nur unter 64 bit OSsen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837182</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837182</guid><dc:creator><![CDATA[gnah!]]></dc:creator><pubDate>Mon, 11 Jan 2010 22:13:10 GMT</pubDate></item><item><title><![CDATA[Reply to Erste Bytes einer Datei ändern on Mon, 11 Jan 2010 22:16:17 GMT]]></title><description><![CDATA[<p>Schau doch einfach mal wie lange es dauert, wenn du die Datei einfach mit einem C++-Filestream öffnest, den ersten Byte abänderst und speicherst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837185</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837185</guid><dc:creator><![CDATA[Kóyaánasqatsi]]></dc:creator><pubDate>Mon, 11 Jan 2010 22:16:17 GMT</pubDate></item><item><title><![CDATA[Reply to Erste Bytes einer Datei ändern on Mon, 11 Jan 2010 22:17:08 GMT]]></title><description><![CDATA[<p>Sind die Zahlen binär abgelegt oder im ASCII/Unicode-Format?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837186</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837186</guid><dc:creator><![CDATA[Icematix]]></dc:creator><pubDate>Mon, 11 Jan 2010 22:17:08 GMT</pubDate></item><item><title><![CDATA[Reply to Erste Bytes einer Datei ändern on Mon, 11 Jan 2010 22:19:00 GMT]]></title><description><![CDATA[<p>Icematix schrieb:</p>
<blockquote>
<p>Sind die Zahlen binär abgelegt oder im ASCII/Unicode-Format?</p>
</blockquote>
<p>Die sind binär gespeichert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1837189</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837189</guid><dc:creator><![CDATA[Hilfelos]]></dc:creator><pubDate>Mon, 11 Jan 2010 22:19:00 GMT</pubDate></item><item><title><![CDATA[Reply to Erste Bytes einer Datei ändern on Mon, 11 Jan 2010 22:51:26 GMT]]></title><description><![CDATA[<p>So:</p>
<pre><code class="language-cpp">std::ofstream file(&quot;file.txt&quot;);
file.seekp(0, std::ios_base::beg);
file.put(9);
file.put(4);
file.close();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1837207</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837207</guid><dc:creator><![CDATA[Icematix]]></dc:creator><pubDate>Mon, 11 Jan 2010 22:51:26 GMT</pubDate></item><item><title><![CDATA[Reply to Erste Bytes einer Datei ändern on Mon, 11 Jan 2010 22:49:34 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;tchar.h&gt;
#include &lt;windows.h&gt;
#include &lt;iostream&gt;

///////////////////////////////////////////////////////////////////////////////

void reportError(const wchar_t* functionName, int errorCode)
{
    std::wcerr &lt;&lt; L&quot;\'&quot; &lt;&lt; functionName &lt;&lt; L&quot;\' has failed with error code &quot; &lt;&lt; errorCode &lt;&lt; std::endl;
}

int _tmain(int argc, TCHAR* argv[])
{
    if (2 != argc)
    {
        std::wcerr &lt;&lt; L&quot;Syntax: myapp &lt;file&gt;&quot; &lt;&lt; std::endl;
        return EXIT_FAILURE;
    }

    HANDLE file = CreateFile(argv[1], 
                             GENERIC_READ | GENERIC_WRITE, 
                             FILE_SHARE_READ | FILE_SHARE_WRITE, 
                             NULL, 
                             OPEN_EXISTING, 
                             FILE_ATTRIBUTE_NORMAL, 
                             NULL);

    if (INVALID_HANDLE_VALUE == file)
    {
        reportError(L&quot;CreateFile(..)&quot;, GetLastError());
        return EXIT_FAILURE;
    }

    unsigned char buffer[] = { 0x01, 0x02, 0x03, 0x04 };
    DWORD numberOfBytes = sizeof(buffer) / sizeof(buffer[0]);
    DWORD numberOfBytesWritten = 0;
    BOOL result = WriteFile(file, buffer, numberOfBytes, &amp;numberOfBytesWritten, NULL);
    if (FALSE == result)
    {
        reportError(L&quot;WriteFile(..)&quot;, GetLastError());
    }

    CloseHandle(file);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1837209</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1837209</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Mon, 11 Jan 2010 22:49:34 GMT</pubDate></item></channel></rss>