<?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[C++ Datei kopieren]]></title><description><![CDATA[<p>Hi, ich hab hier eine kleine Funktion zum kopieren von Daten, aber dabei werden leider nicht die Dateiattribute wie &quot;versteckt&quot; oder ähnliches kopiert... wie kann man diese Sachen machen ?</p>
<pre><code class="language-cpp">long CopyData(string Input, string Output, long BufferSize)
{
    char *Buffer;
    long DataSize = 0;
    long CopyStatus = 0;
    long MainBufferSize = 0;

    ifstream infile(Input.c_str(),ifstream::binary);
    if(infile.is_open() == false) return -1;   
    ofstream outfile(Output.c_str(),ifstream::binary);
    if(outfile.is_open() == false) return -2;

    infile.seekg(0,ifstream::end);
    DataSize = infile.tellg();
    infile.seekg(0, ifstream::beg);  

    Buffer = new char[BufferSize];
    MainBufferSize = BufferSize;   

    /* Datei kopieren */
    while(!infile.eof())
    {
        /* Binärdaten auslesen */
        CopyStatus += BufferSize;
        if(CopyStatus &gt; DataSize)
        {
            MainBufferSize = BufferSize - (CopyStatus - DataSize);
        }
        else
        {
            MainBufferSize = BufferSize;
        }
        infile.read (Buffer, MainBufferSize);     

        /* Binärdaten wieder schreiben */
        outfile.write (Buffer, MainBufferSize);   
    }

    /* Aufräumen */
    delete[] Buffer;
    infile.close();
    outfile.close(); 
    return DataSize;
}
</code></pre>
<p>So, wenn ich also einen versteckte Datei z.B. kopiere, dann ist diese nach der Funktion zwar funktions bereit, aber nicht mehr versteckt.. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Gruß Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/187002/c-datei-kopieren</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 14:10:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/187002.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 14 Jul 2007 14:16:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to C++ Datei kopieren on Sat, 14 Jul 2007 14:16:19 GMT]]></title><description><![CDATA[<p>Hi, ich hab hier eine kleine Funktion zum kopieren von Daten, aber dabei werden leider nicht die Dateiattribute wie &quot;versteckt&quot; oder ähnliches kopiert... wie kann man diese Sachen machen ?</p>
<pre><code class="language-cpp">long CopyData(string Input, string Output, long BufferSize)
{
    char *Buffer;
    long DataSize = 0;
    long CopyStatus = 0;
    long MainBufferSize = 0;

    ifstream infile(Input.c_str(),ifstream::binary);
    if(infile.is_open() == false) return -1;   
    ofstream outfile(Output.c_str(),ifstream::binary);
    if(outfile.is_open() == false) return -2;

    infile.seekg(0,ifstream::end);
    DataSize = infile.tellg();
    infile.seekg(0, ifstream::beg);  

    Buffer = new char[BufferSize];
    MainBufferSize = BufferSize;   

    /* Datei kopieren */
    while(!infile.eof())
    {
        /* Binärdaten auslesen */
        CopyStatus += BufferSize;
        if(CopyStatus &gt; DataSize)
        {
            MainBufferSize = BufferSize - (CopyStatus - DataSize);
        }
        else
        {
            MainBufferSize = BufferSize;
        }
        infile.read (Buffer, MainBufferSize);     

        /* Binärdaten wieder schreiben */
        outfile.write (Buffer, MainBufferSize);   
    }

    /* Aufräumen */
    delete[] Buffer;
    infile.close();
    outfile.close(); 
    return DataSize;
}
</code></pre>
<p>So, wenn ich also einen versteckte Datei z.B. kopiere, dann ist diese nach der Funktion zwar funktions bereit, aber nicht mehr versteckt.. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Gruß Chris</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1325341</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1325341</guid><dc:creator><![CDATA[Foxx90]]></dc:creator><pubDate>Sat, 14 Jul 2007 14:16:19 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Datei kopieren on Sun, 15 Jul 2007 01:14:58 GMT]]></title><description><![CDATA[<p>Hallo,<br />
Dateiattribute sind Dateisystemabhängig und damit außerhalb von Standard-C++. Welches BS verwendest du?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1325617</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1325617</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Sun, 15 Jul 2007 01:14:58 GMT</pubDate></item><item><title><![CDATA[Reply to C++ Datei kopieren on Sun, 15 Jul 2007 08:14:31 GMT]]></title><description><![CDATA[<p>Hi, hat sich durch einen anderen Thread erledigt :), ich benutze Win XP, und regel das nun mit GetFileAttributes und SetFileAttributes <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> danke !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1325662</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1325662</guid><dc:creator><![CDATA[Foxx90]]></dc:creator><pubDate>Sun, 15 Jul 2007 08:14:31 GMT</pubDate></item></channel></rss>