Originally Posted by starkhorn
Here you go. Sorry if it's too long and thanks for taking the time to help.
Code:
int main(int argc, char *argv[])
{
ifstream fin;
ofstream fout;
string szLine = "";
int game_num = 0, turn_num = 0, nation_num = 0, compare_string_choice = 0;
CHARACTER char_list[NUM_OF_CHARS];
fin.open("test.xml");
if(fin.fail())
{
cout << "ERROR\n";
return; }
fout.open("out_test.xml");
if (fout.fail())
{
cout << "ERROR output";
return; }
while (!fin.eof())
{
getline(fin,szLine,'>');
switch(compare_string_choice)
{
case 0:
if (compare_string(szLine,GameNo_String))
{
game_num=(get_info(fin,szLine,compare_string_choice));
cout << "Game number:- " << game_num << endl;
}
break;
case 1:
if (compare_string(szLine,TurnNo_String))
{
turn_num=(get_info(fin,szLine,compare_string_choice));
cout << "Turn number:- " << turn_num << endl;
}
break;
case 2:
if (compare_string(szLine,NationNo_String))
{
nation_num=(get_info(fin,szLine,compare_string_choice));
cout << "Nation number:- " << nation_num << endl;
}
break;
default:
break;
}
}
fout.close();
fin.close();
// cout << "The number of argc elements are " << argc << endl;
// cout << "The location of the program is " << argv[0] << endl << endl;
return 1;
}