<?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[struct an &amp;quot;header&amp;quot;-Funktion übergeben]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie übergebe ich structs an Funktionen, die in einer headerdatei stehen? Ich versuche mal darzustellen;</p>
<p>main.cpp</p>
<pre><code>#include &quot;header.h&quot;

struct Eins
{
   //
};

struct Zwei
{
    //
};

int main()
{
    Eins eins;
    Zwei zwei;

    func(eins, zwei);
}
</code></pre>
<p>header.h</p>
<pre><code>void func(Eins, Zwei);
</code></pre>
<p>header.cpp</p>
<pre><code>void func(Eins, Zwei)
{
    //
}
</code></pre>
<p>Habe es jetzt einfach in den Foreneditor geschrieben, hoffe ist trotzdem kein Unsinn. Jedenfalls kommt die Meldung, Eins und Zwei sind nicht deklariert. Müsste ich die structs in einen eigenen Header schreiben und jeweils einbinden oder kann ich das auch anders machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/340339/struct-an-quot-header-quot-funktion-übergeben</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Apr 2026 07:11:14 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/340339.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 Nov 2016 13:31:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 13:31:07 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie übergebe ich structs an Funktionen, die in einer headerdatei stehen? Ich versuche mal darzustellen;</p>
<p>main.cpp</p>
<pre><code>#include &quot;header.h&quot;

struct Eins
{
   //
};

struct Zwei
{
    //
};

int main()
{
    Eins eins;
    Zwei zwei;

    func(eins, zwei);
}
</code></pre>
<p>header.h</p>
<pre><code>void func(Eins, Zwei);
</code></pre>
<p>header.cpp</p>
<pre><code>void func(Eins, Zwei)
{
    //
}
</code></pre>
<p>Habe es jetzt einfach in den Foreneditor geschrieben, hoffe ist trotzdem kein Unsinn. Jedenfalls kommt die Meldung, Eins und Zwei sind nicht deklariert. Müsste ich die structs in einen eigenen Header schreiben und jeweils einbinden oder kann ich das auch anders machen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513743</guid><dc:creator><![CDATA[zeropage]]></dc:creator><pubDate>Tue, 01 Nov 2016 13:31:07 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 13:40:20 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wenn auch immer Du einen Typ oder einen anderen Bezeichner verwendest, muß dieser <strong>VORHER</strong><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="😉"
    /> bekannt sein. Nicht hinterher.</p>
<p>Du solltest also die Deklaration von Eins und Zwei in die Datei header.h <strong>VOR</strong> dem Prototypen von func verschieben.</p>
<p>VG Martin<br />
<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="😉"
    /> <strong>Innerhalb</strong> einer Klassendeklaration, darf er auch hinterher stehen. Das ist aber die einzige Ausnahme.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513744</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513744</guid><dc:creator><![CDATA[mgaeckler]]></dc:creator><pubDate>Tue, 01 Nov 2016 13:40:20 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 14:17:45 GMT]]></title><description><![CDATA[<p>Bin mir nicht sicher, ob ich richtig verstanden habe, das läuft doch aber dann auf eigene Header für die structs hinaus? Ich will ja nicht die structs in diesem funktionsheader haben.</p>
<p>Eigentlich möchte ich ein, zwei spezielle Funktionen haben, die sonst im Hauptprogramm nicht direkt benötigt werden, falls aber doch, ich sie einfach fix über einen Header einbinde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513748</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513748</guid><dc:creator><![CDATA[zeropage]]></dc:creator><pubDate>Tue, 01 Nov 2016 14:17:45 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 14:59:31 GMT]]></title><description><![CDATA[<p>Du bist jetzt seit sechs Jahren Anfänger. So langsam solltest du diese trivialen Dinge doch beherrschen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513764</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Tue, 01 Nov 2016 14:59:31 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 15:03:25 GMT]]></title><description><![CDATA[<p>Hi,<br />
kannst es entweder so machen:<br />
test1.h</p>
<pre><code>struct Teststruct1
{
	std::string wert1_struct1;
};

class Tester
{
private:
	Teststruct1 test;

public:
	void funktion1(Teststruct1 test2);
};
</code></pre>
<p>das dein struct vor deiner funktion oder klasse definiert ist.<br />
(hier ist jetzt nat. nur der header gezeigt, rest sollte ja klar sein <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> )</p>
<p>oder machst wie schon gesagt einfach eine eigene header-datei für deine structs, in etwa so:</p>
<p>main.cpp</p>
<pre><code>Teststruct1 teststruct1;
	teststruct1.wert1_struct1 = &quot;Hallo Welt&quot;;
	std::cout &lt;&lt; teststruct1.wert1_struct1 &lt;&lt; std::endl;

	Tester testObj;
	testObj.funktion1(teststruct1);
</code></pre>
<p>test1.h</p>
<pre><code>#include &quot;struct.h&quot;

class Tester
{
private:
	Teststruct1 test;

public:
	void funktion1(Teststruct1 test2);
};
</code></pre>
<p>test1.cpp</p>
<pre><code>#include &lt;iostream&gt;
#include &quot;test1.h&quot;

void Tester::funktion1( Teststruct1 test2 )
{
	std::cout &lt;&lt; test2.wert1_struct1 &lt;&lt; std::endl;
}
</code></pre>
<p>struct.h</p>
<pre><code>#include &lt;string&gt;

struct Teststruct1
{
	std::string wert1_struct1;
};
</code></pre>
<p>hoff konnte etwas helfen<br />
lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513765</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513765</guid><dc:creator><![CDATA[HHelPPerS]]></dc:creator><pubDate>Tue, 01 Nov 2016 15:03:25 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 15:11:11 GMT]]></title><description><![CDATA[<p>lemon03 schrieb:</p>
<blockquote>
<p>Bin mir nicht sicher, ob ich richtig verstanden habe, das läuft doch aber dann auf eigene Header für die structs hinaus? Ich will ja nicht die structs in diesem funktionsheader haben.</p>
</blockquote>
<p>Nein, sie müssen nur vorher definiert sein, bzw. die Funktionsdeklaration <strong>nach</strong> der struct-Definition.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513769</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513769</guid><dc:creator><![CDATA[DirkB]]></dc:creator><pubDate>Tue, 01 Nov 2016 15:11:11 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 17:49:27 GMT]]></title><description><![CDATA[<p>Danke für die Antworten, aber</p>
<p>manni66 schrieb:</p>
<blockquote>
<p>Du bist jetzt seit sechs Jahren Anfänger. So langsam solltest du diese trivialen Dinge doch beherrschen.</p>
</blockquote>
<p>nun bin ich erst mal wieder etwas unsicher. Ich werde dann wohl meine structs und die dazugehörigen Funktionen in eigene Header packen. Hat evtl auch den Vorteil, das ich bei anderen Dateiformate nur andere Header schreiben muss, die main aber so lassen kann. Und kann andere Funktionen, die ja eigentlich nicht in die Nähe der structs gehören, dann auslagern.</p>
<p>Im Übrigen bin ich zwar seit 6 Jahren angemeldet, code aber einigermaßen ernsthaft erst seit einem Jahr. Außerdem kann man in einem Monat 60 Stunden üben, oder in 5 Jahren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513796</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513796</guid><dc:creator><![CDATA[zeropage]]></dc:creator><pubDate>Tue, 01 Nov 2016 17:49:27 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 19:06:04 GMT]]></title><description><![CDATA[<p>Ok - ging alles gut - <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="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513805</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513805</guid><dc:creator><![CDATA[zeropage]]></dc:creator><pubDate>Tue, 01 Nov 2016 19:06:04 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 20:36:00 GMT]]></title><description><![CDATA[<p>Zur Sicherheit würde ich aber trotzdem gerne nachfragen, ob das wieder etwas merkwürdig ist. Analog zu meiner ersten Darstellung habe ich es jetzt so gemacht;</p>
<p>struct.h</p>
<pre><code>struct Eins
{
   //
};

//
</code></pre>
<p>struct.cpp</p>
<pre><code>#include &quot;struct.h&quot;

Eins eins;

//
</code></pre>
<p>func.h</p>
<pre><code>#include &quot;struct.h&quot;

void func(Eins);
</code></pre>
<p>func.cpp</p>
<pre><code>#include &quot;func.h&quot;

void func(Eins eins)
{
    //
}
</code></pre>
<p>main.cpp</p>
<pre><code>#include &quot;struct.h&quot;
#include &quot;func.h&quot;

int main()
{

    Eins eins;

    func(eins);
}
</code></pre>
<p>Die Funktion func ist zB nur für eine eventuelle Ausgabe zuständig. Benötigt wird sie für das Programm eigentlich nicht. Wollte sie deshalb irgendwie &quot;auslagern&quot;.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513814</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513814</guid><dc:creator><![CDATA[zeropage]]></dc:creator><pubDate>Tue, 01 Nov 2016 20:36:00 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 21:01:54 GMT]]></title><description><![CDATA[<p>1. Sind das die vollständigen Dateien? Dann fehlen in deinen Header-Dateien die Include-Guards.</p>
<p>2. Wofür soll die Variable <code>Eins eins</code> in struct.cpp gut sein? (übrigens ein beschissener Name - ich hoffe, dass du den nur für uns hier so geändert hast)</p>
<p>3. Eine Frage zu func.h/cpp: Deine Signatur ist <code>void func(Eins);</code> . Wie groß ist denn deine struct Eins? Willst du das wirklich per Value übergeben? Wenn nicht: übergib eine const&amp;. Und wenn du im Header nur Referenzen oder Pointer hast, musst du nicht unbedingt den Header includen, dann reicht auch schon eine Vorwärts-Deklaration.</p>
<p>4. Wenn func nur der Ausgabe diesen soll, warum überlädst du dann nicht einfach den <code>ostream&amp; operator&lt;&lt;(ostream&amp;, const Eins&amp;)</code> ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513816</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513816</guid><dc:creator><![CDATA[wob]]></dc:creator><pubDate>Tue, 01 Nov 2016 21:01:54 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Tue, 01 Nov 2016 21:36:54 GMT]]></title><description><![CDATA[<p>1 - Nö</p>
<p>2 - Natürlich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>Nur soll der Quark ja immer auf ein Minimum beschränkt werden. Minimalistischer geht es wohl nicht mehr?</p>
<p>Rest kommt evtl später ...<br />
später ...</p>
<p>4 - weil func so aussieht?</p>
<pre><code>#include &quot;output.h&quot;
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;iomanip&gt;

void write_dataLog(std::string file_,
                   std::vector &lt;unsigned char&gt; const&amp; bmp_data,
                   Head head, Info info, ColTable colTbl)
{
    const std::string file_name = file_ + &quot;.bmp&quot;;
    std::ofstream file(file_name + &quot;.txt&quot;);
    file &lt;&lt; &quot;_File: &quot; &lt;&lt; file_name &lt;&lt; '\n';
    std::array &lt;std::size_t, head.Size&gt; hbfSize = { 2,4,4,4 };
    std::array &lt;std::size_t, info.Size&gt; ibfSize = { 4,4,4,2,2,4,4,4,4,4,4 };

    //Kopf und Eigenschaften
    file &lt;&lt; '\n' &lt;&lt; '\n';
    file &lt;&lt; &quot;_Kopf_&quot; &lt;&lt; '\n' &lt;&lt; '\n';
    for (auto i=0; i&lt;head.Size; i++)
    {
        file &lt;&lt; std::left;
        file &lt;&lt; '#' &lt;&lt; std::setw(4) &lt;&lt; std::dec &lt;&lt; std::get&lt;0&gt;(head.bType.at(i));
        file &lt;&lt; std::setw(19) &lt;&lt; std::left &lt;&lt; std::get&lt;1&gt;(head.bType.at(i));
        for (std::size_t j=0; j&lt;hbfSize.at(i); j++)
        {
            file &lt;&lt; std::right;
            file &lt;&lt; std::setw(2) &lt;&lt; std::setfill('0') &lt;&lt; std::hex &lt;&lt; int(bmp_data.at(i+j)) &lt;&lt; ' ';
        }
        file &lt;&lt; std::setfill(' ') &lt;&lt; std::setw(3 + 6 * (4/hbfSize.at(i))) &lt;&lt; std::dec &lt;&lt; head.data.at(i) &lt;&lt; '\n'; //Dezimalwert
    }
    file &lt;&lt; '\n' &lt;&lt; '\n';
    file &lt;&lt; &quot;_Eigenschaften_&quot; &lt;&lt; '\n' &lt;&lt; '\n';
    for (auto i=0; i&lt;info.Size; i++)
    {
        file &lt;&lt; std::left;
        file &lt;&lt; '#' &lt;&lt; std::setw(4) &lt;&lt; std::dec &lt;&lt; std::get&lt;0&gt;(info.bType.at(i));
        file &lt;&lt; std::setw(19) &lt;&lt; std::left &lt;&lt; std::get&lt;1&gt;(info.bType.at(i));
        for (std::size_t j=0; j&lt;ibfSize.at(i); j++)
        {
            file &lt;&lt; std::right;
            file &lt;&lt; std::setw(2) &lt;&lt; std::setfill('0') &lt;&lt; std::hex &lt;&lt; int(bmp_data.at(i+j)) &lt;&lt; ' ';
        }
        file &lt;&lt; std::setfill(' ') &lt;&lt; std::setw(3 + 6 * (4/ibfSize.at(i))) &lt;&lt; std::dec &lt;&lt; info.data.at(i) &lt;&lt; '\n'; //Dezimalwert
    }

    // Farbmasken  //wird zur Zeit erstmal abgebrochen
    int biCompression = info.data.at(5);
    if (biCompression != 0)
    {
        file &lt;&lt; '\n'
             &lt;&lt; &quot;biCompression = &quot; &lt;&lt; biCompression &lt;&lt; '\n'
             &lt;&lt; &quot;Bilddaten sind kodiert\nkann im Moment nicht verarbeitet werden&quot; &lt;&lt; '\n';
        file.close();
    }

    // Farbtabelle
    file &lt;&lt; '\n' &lt;&lt; '\n';
    file &lt;&lt; &quot;_Farbtabelle_ &quot;;
    if (colTbl.is_ )
    {
        file &lt;&lt; &quot;     Size: &quot; &lt;&lt; colTbl.size_ &lt;&lt; '\n' &lt;&lt; '\n';
        file &lt;&lt; std::setw(9) &lt;&lt; &quot;B&quot; &lt;&lt; std::setw(3) &lt;&lt; &quot;G&quot; &lt;&lt; std::setw(3) &lt;&lt; &quot;R&quot;;
        file &lt;&lt; std::setw(14) &lt;&lt; &quot;B&quot; &lt;&lt; std::setw(5) &lt;&lt; &quot;G&quot; &lt;&lt; std::setw(5) &lt;&lt; &quot;R&quot;;
        file &lt;&lt; '\n' &lt;&lt; '\n';
        std::size_t offset = 54;
        for (auto i=0; i&lt;colTbl.size_; i++)
        {
            file &lt;&lt; std::left;
            file &lt;&lt; '#' &lt;&lt; std::setw(6) &lt;&lt; std::setfill(' ') &lt;&lt; std::dec &lt;&lt; offset;
            file &lt;&lt; std::right &lt;&lt; std::hex;
            file &lt;&lt; std::setw(2) &lt;&lt; std::setfill('0') &lt;&lt; int(std::get &lt;0&gt; (colTbl.data.at(i))) &lt;&lt; ' '
                 &lt;&lt; std::setw(2) &lt;&lt; std::setfill('0') &lt;&lt; int(std::get &lt;1&gt; (colTbl.data.at(i))) &lt;&lt; ' '
                 &lt;&lt; std::setw(2) &lt;&lt; std::setfill('0') &lt;&lt; int(std::get &lt;2&gt; (colTbl.data.at(i))) &lt;&lt; ' '
                 &lt;&lt; std::setw(2) &lt;&lt; std::setfill('0') &lt;&lt; int(std::get &lt;3&gt; (colTbl.data.at(i))) &lt;&lt; ' ';
            file &lt;&lt; std::dec &lt;&lt; &quot;      &quot;; //Dezimalwerte
            file &lt;&lt; std::setw(4) &lt;&lt; std::setfill(' ') &lt;&lt; int(std::get &lt;0&gt; (colTbl.data.at(i))) &lt;&lt; ' '
                 &lt;&lt; std::setw(4) &lt;&lt; std::setfill(' ') &lt;&lt; int(std::get &lt;1&gt; (colTbl.data.at(i))) &lt;&lt; ' '
                 &lt;&lt; std::setw(4) &lt;&lt; std::setfill(' ') &lt;&lt; int(std::get &lt;2&gt; (colTbl.data.at(i))) &lt;&lt; ' ';

            file &lt;&lt; '\n';
            offset += 4;
        }
    }
    else
    {
        file &lt;&lt; &quot;: keine&quot; &lt;&lt; '\n';
    }
    file.close();

    std::cout &lt;&lt; file_name &lt;&lt; &quot;.log wurde erstellt&quot; &lt;&lt; '\n';
}
</code></pre>
<p>Habe absolut keinen Plan, wie ich das mit <code>ostream&amp; operator&lt;&lt;(ostream&amp;, const Eins&amp;)?</code> machen soll?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513817</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513817</guid><dc:creator><![CDATA[zeropage]]></dc:creator><pubDate>Tue, 01 Nov 2016 21:36:54 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Wed, 02 Nov 2016 07:10:26 GMT]]></title><description><![CDATA[<p>Schau doch mal im Magazin nach.<br />
<a href="https://www.c-plusplus.net/forum/232010">https://www.c-plusplus.net/forum/232010</a><br />
Punkt 3.4</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2513830</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513830</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Wed, 02 Nov 2016 07:10:26 GMT</pubDate></item><item><title><![CDATA[Reply to struct an &amp;quot;header&amp;quot;-Funktion übergeben on Wed, 02 Nov 2016 07:40:02 GMT]]></title><description><![CDATA[<p>lemon03 schrieb:</p>
<blockquote>
<p>Nur soll der Quark ja immer auf ein Minimum beschränkt werden. Minimalistischer geht es wohl nicht mehr?</p>
</blockquote>
<p>Auf ein nachvollziehbares Minimum. Ich war, als du geschrieben hast, dass func(Eins) der Ausgabe diene, natürlich davon ausgegangen, dass func nur Eins irgendwie ausgibt. Du hast aber viel mehr Parameter und nutzt die Eins-Variable nur als Hilfe zur Ausgabe von bmp_data, daher ergibt mein Hinweis auf operator&lt;&lt; natürlich so erstmal wenig Sinn.</p>
<blockquote>
<p>4 - weil func so aussieht?</p>
</blockquote>
<p>Zu func hätte ich diverse Fragen/Anmerkungen.<br />
0. ganz schön lang... allerdings nur Ausgabe. Statt file vielleicht besser den <code>ostream&amp;</code> übergeben, in den geschrieben werden soll und das Öffnen/Schließen/Errorchecking separat machen?</p>
<ol>
<li><code>std::ofstream file(file_name + &quot;.txt&quot;);</code> ... <code>std::cout &lt;&lt; file_name &lt;&lt; &quot;.log wurde erstellt&quot; &lt;&lt; '\n';</code> ist inkonsistent. Variable log_file_name einführen? Und sollte die Variable <code>file_</code> vielleicht besser <code>basename</code> heißen?<br />
2. Check ob Datei auch is_open ist?<br />
3. hbfSize / ibfSize: Ein Kommentar täte gut. Was sind das für magische Zahlen? Gehören diese Konstanten nicht eher in die Head- bzw Info-Klasse?<br />
4. Du verwendest viel <code>std::get&lt;0,1,...&gt;</code> im Code, obwohl der nicht generisch aussieht. Warum? Könnte man nicht anständige Namen verwenden?<br />
5. Im Fall <code>biCompression != 0</code> machst du <code>file.close()</code> und danach wird munter weiter in file geschrieben und file nochmal geschlossen.<br />
6. (ich wiederhole mich) Warum sind file_, head, info, colTbl nicht per <code>const&amp;</code> übergeben?</li>
</ol>
]]></description><link>https://www.c-plusplus.net/forum/post/2513836</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2513836</guid><dc:creator><![CDATA[wob]]></dc:creator><pubDate>Wed, 02 Nov 2016 07:40:02 GMT</pubDate></item></channel></rss>