<?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[.at() probleme]]></title><description><![CDATA[<p>Hi Leute<br />
Beim ausführen meines programms kommt hier der Fehler:</p>
<pre><code>terminate called after throwing an instance of std::out_of_range what(): basic_string::at
</code></pre>
<p>Ich weiß nicht was ich falsch mache.</p>
<p>Hier der Quelltext:</p>
<p>conflib.cpp</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;   //exit();

#include &quot;conflib.hpp&quot;

   conf Zeilen;
   conf Conf;
   conf Linien;

    void confLoad(const char *Pfad)
    {

        Conf.File.open(Pfad, std::ios::in);

        while(!Conf.File.eof())
        {
            Conf.File.getline(Linien.linie, 1024);
            Zeilen.zeile.push_back(Linien.linie);
        }

    }

    void confClose()
    {
        Conf.File.close();
    }

    void confSave(const char *Name)
    {
        Conf.File.open(Name, std::ios::out);
    }
</code></pre>
<p>conflib_aus.cpp</p>
<pre><code class="language-cpp">#include &lt;stdlib.h&gt;   //exit();
#include &lt;iostream&gt;

#include &quot;conflib.hpp&quot;
#include &quot;conflib_aus.hpp&quot;

    conf_aus Search;
    conf_aus A;
    conf_aus E;
    conf_aus Var;

    void confGroup(const char *Group_Name)
    {

        for(unsigned int i=0; i &lt; Zeilen.zeile.size(); i++)
        {
            unsigned int Ende_Name = Zeilen.zeile[i].size();

                if(Zeilen.zeile[i].at(0) == '[' &amp;&amp; Zeilen.zeile[i].at(Ende_Name) == ']')
                {
                    Search.Name = Zeilen.zeile[i].substr(1, Ende_Name - 1);

                A.Anfang_Group = i + 1;
                do
                {
                    i++;
                }while(Zeilen.zeile[i].at(0) != '[');
                E.Ende_Group = i - 1;

                }

        }

        if(Group_Name != Search.Name.c_str())
        {
            exit(0);
        }else{
            exit(-1);
        }

    }

    void confRead(const char *Group_Name, const char *Read_Name)
    {
        for(int i = A.Anfang_Group; i &lt; E.Ende_Group; i++)
        {
            unsigned int j=0;
            if(Zeilen.zeile[i].at(j) != '=')
            {
                j++;
            }

            if(Read_Name == Zeilen.zeile[i].substr(0, j))
            {
                exit(0);
            }else{
                exit(-1);
            }

            Var.Name_Var = Zeilen.zeile[i].substr(j+1);
        }
        std::cout &lt;&lt; Var.Name_Var &lt;&lt; std::endl;
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/267784/at-probleme</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 06:04:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/267784.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 30 May 2010 12:52:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 12:52:51 GMT]]></title><description><![CDATA[<p>Hi Leute<br />
Beim ausführen meines programms kommt hier der Fehler:</p>
<pre><code>terminate called after throwing an instance of std::out_of_range what(): basic_string::at
</code></pre>
<p>Ich weiß nicht was ich falsch mache.</p>
<p>Hier der Quelltext:</p>
<p>conflib.cpp</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;   //exit();

#include &quot;conflib.hpp&quot;

   conf Zeilen;
   conf Conf;
   conf Linien;

    void confLoad(const char *Pfad)
    {

        Conf.File.open(Pfad, std::ios::in);

        while(!Conf.File.eof())
        {
            Conf.File.getline(Linien.linie, 1024);
            Zeilen.zeile.push_back(Linien.linie);
        }

    }

    void confClose()
    {
        Conf.File.close();
    }

    void confSave(const char *Name)
    {
        Conf.File.open(Name, std::ios::out);
    }
</code></pre>
<p>conflib_aus.cpp</p>
<pre><code class="language-cpp">#include &lt;stdlib.h&gt;   //exit();
#include &lt;iostream&gt;

#include &quot;conflib.hpp&quot;
#include &quot;conflib_aus.hpp&quot;

    conf_aus Search;
    conf_aus A;
    conf_aus E;
    conf_aus Var;

    void confGroup(const char *Group_Name)
    {

        for(unsigned int i=0; i &lt; Zeilen.zeile.size(); i++)
        {
            unsigned int Ende_Name = Zeilen.zeile[i].size();

                if(Zeilen.zeile[i].at(0) == '[' &amp;&amp; Zeilen.zeile[i].at(Ende_Name) == ']')
                {
                    Search.Name = Zeilen.zeile[i].substr(1, Ende_Name - 1);

                A.Anfang_Group = i + 1;
                do
                {
                    i++;
                }while(Zeilen.zeile[i].at(0) != '[');
                E.Ende_Group = i - 1;

                }

        }

        if(Group_Name != Search.Name.c_str())
        {
            exit(0);
        }else{
            exit(-1);
        }

    }

    void confRead(const char *Group_Name, const char *Read_Name)
    {
        for(int i = A.Anfang_Group; i &lt; E.Ende_Group; i++)
        {
            unsigned int j=0;
            if(Zeilen.zeile[i].at(j) != '=')
            {
                j++;
            }

            if(Read_Name == Zeilen.zeile[i].substr(0, j))
            {
                exit(0);
            }else{
                exit(-1);
            }

            Var.Name_Var = Zeilen.zeile[i].substr(j+1);
        }
        std::cout &lt;&lt; Var.Name_Var &lt;&lt; std::endl;
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1904463</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904463</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Sun, 30 May 2010 12:52:51 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 12:57:59 GMT]]></title><description><![CDATA[<p>unsigned int Ende_Name = Zeilen.zeile[i].size();</p>
<p>=&gt; Zeilen.zeile[i].at(Ende_Name <strong>- 1</strong>) ist das letzte Element, auf das du zugreifen kannst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904465</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Sun, 30 May 2010 12:57:59 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 13:09:08 GMT]]></title><description><![CDATA[<p>Ah ok<br />
Thx für die schnelle Antwort.</p>
<p>Edit:<br />
Da muss noch ein Fehler drin sein die Konsole gibt immer noch den gleichen fehler aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904472</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904472</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Sun, 30 May 2010 13:09:08 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 13:13:11 GMT]]></title><description><![CDATA[<p>gamebuntu schrieb:</p>
<blockquote>
<p>Edit:<br />
Da muss noch ein Fehler drin sein die Konsole gibt immer noch den gleichen fehler aus.</p>
</blockquote>
<p>Wie wärs mit Debuggen? Bei einer ungefangenen Exception solltest du in die Zeile gelangen, in der sie geworfen wird. Von da aus kannst du im Funktions-Stapelrahmen soweit nach oben gehen, bis du zu deinem Code kommst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904478</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904478</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 30 May 2010 13:13:11 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 14:13:42 GMT]]></title><description><![CDATA[<p>Debuggen? Da schreibt man sich mal einen Unittest für.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904510</guid><dc:creator><![CDATA[Artchi]]></dc:creator><pubDate>Sun, 30 May 2010 14:13:42 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 14:18:57 GMT]]></title><description><![CDATA[<p>Artchi schrieb:</p>
<blockquote>
<p>Debuggen? Da schreibt man sich mal einen Unittest für.</p>
</blockquote>
<p>Ein Unittest ist wohl nicht das richtige Mittel einen vorhandenen, kleinen Bug zu finden. Debugger an und nach ner halben Minute sich an die Stirn klopfen.<br />
Und nächste mal gibts dann gleich den passenden Test dazu <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/1904514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904514</guid><dc:creator><![CDATA[brotbernd]]></dc:creator><pubDate>Sun, 30 May 2010 14:18:57 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 18:19:32 GMT]]></title><description><![CDATA[<p>Der Debugger funktioniert bei mir nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904633</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904633</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Sun, 30 May 2010 18:19:32 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 18:34:05 GMT]]></title><description><![CDATA[<p>was auch immer du für ne IDE hast. Wenn du schon keinen Debugger hast, dann<br />
kannst du mit ein paar Ausgaben auf die Konsole oder eine Datei auch ganz gut so manches herausbekommen.</p>
<p>gamebuntu schrieb:</p>
<blockquote>
<p>Da muss noch ein Fehler drin sein die Konsole gibt immer noch den gleichen fehler aus.</p>
</blockquote>
<p>Das solltest du nur sagen, wenn man den Code in die IDE kopieren und direkt compilieren kann. Mit Fragementen ist das immer schlecht.</p>
<p>Versuch den Fehler etwas einzugrenzen.<br />
Ist es immer noch bei Zeile 19 oder nun bei 49 oder vielleicht ganz woanders?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904637</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904637</guid><dc:creator><![CDATA[BasicMan01]]></dc:creator><pubDate>Sun, 30 May 2010 18:34:05 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Sun, 30 May 2010 19:30:27 GMT]]></title><description><![CDATA[<p>gamebuntu schrieb:</p>
<blockquote>
<p>Der Debugger funktioniert bei mir nicht.</p>
</blockquote>
<p>Hast du Debugging Symbols in dein Programm gemacht und sie danach auch nicht mehr rausgestrippt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904657</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904657</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Sun, 30 May 2010 19:30:27 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 05:14:17 GMT]]></title><description><![CDATA[<p>OK<br />
Ich benutz als IDE Code Blocks für Linux.<br />
Was habt ihr für IDEs, könnt ihr mir vielleicht eine bessere empfehlen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904722</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904722</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 05:14:17 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 08:48:18 GMT]]></title><description><![CDATA[<p>gamebuntu schrieb:</p>
<blockquote>
<p>OK<br />
Ich benutz als IDE Code Blocks für Linux.<br />
Was habt ihr für IDEs, könnt ihr mir vielleicht eine bessere empfehlen.</p>
</blockquote>
<p>Tut nichts zur Sache, hab ich auch (unter Windows, unter Linux hab ich noch nie debuggt). Geh in deinem Projekt auf Project-&gt;Build Options und links auf Debug (sonst nimm was anderes), dann schalte -p an und -s aus (falls es noch nicht stimmt). Du solltest das Ganze im gleichen Modus kompilieren (also oben in der Symbolleiste auch auf Debug oder das, was du genommen hast, schalten).<br />
Dann setzt du links irgendwo einen Breakpoint (der rote Punkt rechts neben der Zeilenzahl) und startest den Debugger mit F8. Er sollte entweder bei einer Benutzerinteraktion auf deine Aktivität warten oder direkt zum Breakpoint gelangen. Mit F7 kannst du dann Debuggen. (Ich bin mir nicht ganz sicher, ob das mit den F-Tasten funktioniert, bei mir hat's einmal funktioniert und sonst nicht, vielleicht war das, als ich Compiz hatte, sonst nimm einfach die Symbolleiste oder das Menü).</p>
<p>P.S. Unter Debug-&gt;Debugging Windows-&gt;Watches kannst du die Werte von lokalen Variablen und Funktionsparametern betrachten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904787</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904787</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Mon, 31 May 2010 08:48:18 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 08:48:08 GMT]]></title><description><![CDATA[<p>Bitte nicht sowas machen:</p>
<pre><code class="language-cpp">unsigned int i = vec.size();
for(unsigned int j = 0; j &lt; (i - 1); ++j)
{ 
//...
}
</code></pre>
<p>Denn bei dem (i - 1) kommt bei size == 0 NICHT -1 raus. Schließlich ist das unsigned.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904789</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904789</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Mon, 31 May 2010 08:48:08 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 11:47:01 GMT]]></title><description><![CDATA[<p>wxskip bei mir kommt :</p>
<pre><code>You must select a host application to &quot;run&quot; a library...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1904866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904866</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 11:47:01 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 11:56:34 GMT]]></title><description><![CDATA[<p>gamebuntu schrieb:</p>
<blockquote>
<p>wxskip bei mir kommt :</p>
<pre><code>You must select a host application to &quot;run&quot; a library...
</code></pre>
</blockquote>
<p>Klingt danach, als wolltest du eine Library debuggen, ohne sie in einer Anwendung zu benutzen. Wenn es das ist, mach eine Anwendung, in der du die Library verwendest.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904869</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904869</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Mon, 31 May 2010 11:56:34 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 11:59:42 GMT]]></title><description><![CDATA[<p>Ja<br />
Ich bin gerade an meiner ersten aber nur für den Eigengebrauch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904871</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904871</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 11:59:42 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 14:36:14 GMT]]></title><description><![CDATA[<p>Ok hab eine Anwendung gemacht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1904990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1904990</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 14:36:14 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 14:49:46 GMT]]></title><description><![CDATA[<p>Und, funktioniert es?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905002</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905002</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Mon, 31 May 2010 14:49:46 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 14:52:52 GMT]]></title><description><![CDATA[<p>Man soll doch unter Projekt -&gt; Set programs arguments... -&gt; debug unter host application die lib.a einsetzen.</p>
<p>Dann hab ich es richtig.<br />
Er zeigt mir in der Zeile 19 das hier an:</p>
<pre><code>-------------- Build: Debug in conflib ---------------

Compiling: conflib.cpp
Compiling: conflib_aus.cpp
/media/nico_/sicherung/ubuntu/Projekt/conflib/conflib_aus.cpp:19: error: stray ‘\305’ in program
/media/nico_/sicherung/ubuntu/Projekt/conflib/conflib_aus.cpp:19: error: stray ‘\231’ in program
Process terminated with status 1 (0 minutes, 2 seconds)
2 errors, 0 warnings
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1905005</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905005</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 14:52:52 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 14:55:23 GMT]]></title><description><![CDATA[<p>1. Das ist bestimmt nicht &quot;Set program arguments&quot;, sondern &quot;Build Options&quot;<br />
2. Dein Fehler bedeutet AFAIK, dass da irgendwelche ungültigen Zeichen, z.B. Umlaute, in deinem Programm sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905007</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Mon, 31 May 2010 14:55:23 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 14:59:19 GMT]]></title><description><![CDATA[<p>Doch ist Set program arguments.</p>
<p>Danke für die hilfe wxskip ohne dich wär ich nie weiter gekommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905010</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905010</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 14:59:19 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 15:01:04 GMT]]></title><description><![CDATA[<p>gamebuntu schrieb:</p>
<blockquote>
<p>Doch ist Set program arguments.</p>
<p>Danke für die hilfe wxskip ohne dich wär ich nie weiter gekommen.</p>
</blockquote>
<p>OK, ist neu für mich <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /><br />
Ich hab aber auch noch nie 'ne Library mit Code::Blocks geschrieben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905011</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905011</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Mon, 31 May 2010 15:01:04 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 15:05:29 GMT]]></title><description><![CDATA[<p>so jetzt find ich nichts mehr aber es kommt bei meiner anwendung immer noch der fehler mit .at().</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905016</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905016</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 15:05:29 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 15:06:37 GMT]]></title><description><![CDATA[<p>gamebuntu schrieb:</p>
<blockquote>
<p>so jetzt find ich nichts mehr aber es kommt bei meiner anwendung immer noch der fehler mit .at().</p>
</blockquote>
<p>Was findest du nicht mehr?<br />
Jetzt kannst du ja den Fehler mit dem Debugger suchen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905019</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905019</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Mon, 31 May 2010 15:06:37 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 15:09:50 GMT]]></title><description><![CDATA[<p>Ich hab ja gesucht aber er findet nichts.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905023</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 15:09:50 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 15:11:35 GMT]]></title><description><![CDATA[<p>Du solltest doch aber zumindest die Zeile herausfinden, wo der Fehler auftritt, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905024</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905024</guid><dc:creator><![CDATA[wxSkip]]></dc:creator><pubDate>Mon, 31 May 2010 15:11:35 GMT</pubDate></item><item><title><![CDATA[Reply to .at() probleme on Mon, 31 May 2010 15:22:17 GMT]]></title><description><![CDATA[<p>hier mal der Quelltext:</p>
<p>conflib.cpp</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;   //exit();

#include &quot;conflib.hpp&quot;

   conf Zeilen;
   conf Conf;
   conf Linien;

    void confLoad(const char *Pfad)
    {

        Conf.File.open(Pfad, std::ios::in);

        while(!Conf.File.eof())
        {
            Conf.File.getline(Linien.linie, 1024);
            Zeilen.zeile.push_back(Linien.linie);
        }

    }

    void confClose()
    {
        Conf.File.close();
    }

    void confSave(const char *Name)
    {
        Conf.File.open(Name, std::ios::out);
    }
</code></pre>
<p>conflib.hpp</p>
<pre><code>#ifndef CONFLIB_HPP_INCLUDED
#define CONFLIB_HPP_INCLUDED

#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;fstream&gt;

struct conf
{
    char linie[1024];
    std::fstream File;
    std::vector &lt;std::string&gt; zeile;
};

extern conf Zeilen;
extern conf Conf;
extern conf Linien;

#endif // CONFLIB_HPP_INCLUDED
</code></pre>
<p>conflib_aus</p>
<pre><code>#include &lt;stdlib.h&gt;   //exit();
#include &lt;iostream&gt;

#include &quot;conflib.hpp&quot;
#include &quot;conflib_aus.hpp&quot;

    conf_aus Search;
    conf_aus A;
    conf_aus E;
    conf_aus Var;

    void confGroup(const char *Group_Name)
    {

        for(unsigned int i=0; i &lt; Zeilen.zeile.size(); i++)
        {
           int Ende_Name = Zeilen.zeile[i].size();

                if(Zeilen.zeile[i].at(0) == '[' &amp;&amp; Zeilen.zeile[i].at(Ende_Name-1) == ']')
                {
                   Search.Name = Zeilen.zeile[i].substr(1, Ende_Name-1);

                   A.Anfang_Group = i + 1;
                   do
                   {
                       i++;
                   }while(Zeilen.zeile[i].at(0) != '[');
                   E.Ende_Group = i - 1;
                }

        }

        if(Group_Name != Search.Name.c_str())
        {
            exit(0);
        }else{
            exit(-1);
        }

    }

    void confRead(const char *Group_Name, const char *Read_Name)
    {
        for(int i = A.Anfang_Group; i &lt; E.Ende_Group; i++)
        {
            int j=0;
            if(Zeilen.zeile[i].at(j) != '=')
            {
                j++;
            }

            if(Read_Name == Zeilen.zeile[i].substr(0, j))
            {
                exit(0);
            }else{
                exit(-1);
            }

            Var.Name_Var = Zeilen.zeile[i].substr(j+1);
        }
        std::cout &lt;&lt; Var.Name_Var &lt;&lt; std::endl;
    }
</code></pre>
<p>conflib_aus.hpp</p>
<pre><code>#ifndef CONFLIB_AUS_HPP_INCLUDED
#define CONFLIB_AUS_HPP_INCLUDED

#include &lt;string&gt;

struct conf_aus
{
    std::string Name;
    int Anfang_Group;
    int Ende_Group;
    std::string Name_Var;
};

extern conf_aus Search;
extern conf_aus A;
extern conf_aus E;
extern conf_aus Var;

#endif // CONFLIB_AUS_HPP_INCLUDED
</code></pre>
<p>Debug den Quelltext bitte ich weiß nicht was ich falsch mach.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1905027</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1905027</guid><dc:creator><![CDATA[CCodex]]></dc:creator><pubDate>Mon, 31 May 2010 15:22:17 GMT</pubDate></item></channel></rss>