001
16.04.2006, 00:30 Uhr
Karldin Shinowa
Professional Noob
|
da hier noch nich viel gekommen ist poste ich einfach mal den ganzen code:
C++: |
struct Choice { string name; string link; }; int main() { string*Namen; int*Spruenge; Choice*Choices; Choice*usedChoice; string puffer; char input; int number; fstream File; File.open("Config.txt",ios::in); getline(File,puffer,'=');//read the word bevore the = if(puffer!="CHOICE NUMBER") { cout<<"ERROR IN CONFIG"; getchar(); return 0; } getline(File,puffer);//read the thing after = File.close(); number=atoi(puffer.c_str());//number is the puffer convented into int Choices=new Choice[number]; for(int i=0;i<number;i++) { getline(File,puffer,'\n');//read line with nothing //ab hier macht er es falsch und liest ne leerzeile ein wo keine ist getline(File,puffer,'=');//read the thing bevore = if(puffer!="CHOICE") { cout<<"ERROR IN CONFIG"; getchar(); return 0; } getline(File,puffer);//read the thing after = Choices[i].name=puffer; getline(File,puffer,'=');//read the thing bevore = if(puffer!="LINK") { cout<<"ERROR IN CONFIG"; getchar(); return 0; } getline(File,puffer);//read the thing after = Choices[i].link=puffer; } bool beenden=false; while(!beenden) { Cls(); cout<<"Welcher Plugin soll verwendet werden?"<<endl; for(int i=0;i<( sizeof(Choices)/sizeof(Choices[0]) );i++) { cout<<i+1<<Choices[i].name<<endl; } input=GetKeypress()-1; if( input>=0&&input<(sizeof(Choices)/sizeof(Choices[0])) ) { usedChoice=&Choices[input]; beenden=true; } } File.open((usedChoice->link).c_str(),ios::in); getline(File,puffer,'=');//read the thing bevore = if(puffer!="UNIT NUMBER") { cout<<"ERROR IN CONFIG"; getchar(); return 0; } getline(File,puffer); number=atoi(puffer.c_str()); Namen=new string[number]; Spruenge=new int(number-1); for(int i=0;i<( sizeof(Namen)/sizeof(Namen[0]) );i++) { getline(File,puffer);//read line with nothing getline(File,puffer,'='); if(puffer!="NAME") { cout<<"ERROR IN CONFIG"; getchar(); return 0; } getline(File,puffer); Namen[i]=puffer; } for(int i=0;i<( sizeof(Spruenge)/sizeof(Spruenge[0]) );i++) { getline(File,puffer);//read line with nothing getline(File,puffer,'='); if(puffer!="EXCHANGE VALUE") { cout<<"ERROR IN CONFIG"; getchar(); return 0; } getline(File,puffer); Spruenge[i]=atoi(puffer.c_str()); } }
|
-- Ich will die Welt verbessern, doch Gott gibt mir nicht den Code. Dieser Post wurde am 16.04.2006 um 00:31 Uhr von Karldin Shinowa editiert. |