Probleme beim Ausführen



  • Hi Leute
    ich versuch seit stunden diesen Fehler hier auszubessern aber ich weiß nicht was ich falsch mache.

    Der Debugger gibt das hier aus:

    #0 00000000	0x00422b92 in std::string::find() (??:??)
    #1 00402F07	section(this=0x22ff1c, xini_sec=@0x22fe00, sec_name={static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x22ff38 "T&>"}}) (E:/sicherung/ubuntu/Projekt/xini/xini.cpp:300)
    #2 004041D3	main() (E:\sicherung\ubuntu\Projekt\xini\main.cpp:14)
    

    xini.h:

    class section;
    class xini
    {
        public:
        xini();
        xini(std::string path);
        ~xini();
    /*...*/
        std::vector<std::string> data;
    
        private:
    /*...*/
    };
    
    class section
    {
        public:
        section(xini &xini_sec, std::string sec_name);
    /*...*/
        friend class xini;
    
        protected:
    /*...*/
        std::vector<std::string> sec;
    /*...*/
    
    };
    

    xini.cpp:

    section::section(xini &xini_sec, std::string sec_name)
    {
        status=false;
        int an_kl, en_kl, an_pos=-1, en_pos=-1, j=-1, i=0;
    
        for(; i != xini_sec.data.size(); i++)
        {
            an_kl=xini_sec.data[i].find_first_of('[', 0);
            if(std::string::npos != an_kl)
            {
                en_kl = xini_sec.data[i].find_first_of(']', an_kl);
                if(std::string::npos != en_kl)
                {
    /*
    ...
    */
                }
            }
        }
    }
    

    Das Problem liegt an xini_sec.data[i] aber ich weiß nicht was daran falsch seien sollte.
    Ich hoffe das ihr mir helfen könnt.

    Grüße,
    gamebuntu



  • Da du nicht sagst, was der Fehler ist, und auch nur Programmfragmente lieferst: eher nicht.



  • Der Debugger zeigt an das der Fehler hier liegt:

    an_kl = xini_sec.data[i].find_first_of('[', 0);

    Aber ich kann den Fehler daran nicht sehen.



  • for(; i < xini_sec.data.size(); i++)
    

    ?



  • Ja man kann auch so schreiben i ist hier :

    int an_kl, en_kl, an_pos=-1, en_pos=-1, j=-1, i=0;


Anmelden zum Antworten