Inhalt eines uChar Arrays filtern



  • Jap, das ist glaub ich nicht ganz das Prob.

    Nur anscheinded fehlt immernoch ein include, da die alten Fehler auch noch da sind.



  • Dann hast du wohl keinen C++-Compiler genutzt. Sind namespaces und somit teil des C++-Standards ...

    edit
    geht in dem Fall aber auch in C ...



  • Hya ! 🕶

    #define PROGGINGMANIAS_BLAH_BLUBB_EXTRACTOR main() // V 0.81 beta   ;-)
    
    #include <iostream>
    #include <vector>
    #include <string>
    using namespace std;
    
    // Proggingmanias blahs and blubss extractor Version 0.81 beta
    int PROGGINGMANIAS_BLAH_BLUBB_EXTRACTOR
    { 
        // Testblubb Buffer
    	char blubberbuff[1024] =  "<Data A=\"Blubb\" A=\"Bla\" / ><Data A=\"Mööp\" / >";
    	int pos1 = 0, pos2 = 0;
    
    	string copy = blubberbuff;				// Blahs and blubbs copy
    	vector <string> blahs_and_blubbs;		// Blahs and blubbs container
    
    	while(1)
    	{
    		pos1 = copy.find( "\"", pos2 +  1 );
    
    		if( pos1 == -1 )
    		{
    			break;
    		}
    
    		pos2 = copy.find( "\"", pos1 + 1 );
    
    		if ( pos2 == -1 ) 
    		{
    			cout << "Error in Token: " << copy << ".  Missing: \"" << endl;
    			break;
    		}
    		blahs_and_blubbs.push_back( copy.substr( pos1+1, pos2 - pos1 - 1 ));
    	}
    
    	// Show the blahs and blubbs !
    	if ( blahs_and_blubbs.size() == 0 )
    	{
    		cout << "Sorry, but there are no blahs and no blubbs available !" << endl;
    	return 0;
    	}
    
    	cout << "Showing blahs: ( and blubbs  ) " << endl;
    	for ( int i = 0; i < blahs_and_blubbs.size(); i++ )
    	{
    		cout << blahs_and_blubbs.at(i) << endl;
    	}
    
        return 0;
    }
    

    Bya ! 🙂


Anmelden zum Antworten